PDA

View Full Version : pyqt New Dialog No Attribute exec_



supertom44
12th July 2010, 13:52
Hi all.

I am using python and pyqt4 to make a simple application. In the history table I want to be able to double click a cell and launch a new dialog.

How ever for some reason when ever I try to do this it gives me the error: "AttributeError: 'HistoryInformation' object has no attribute 'exec_'"

I am trying to run the dialog via:

histinfodlg = histInfo.HistoryInformation(nzb, form)
histinfodlg.exec_()

Here is the code for the histInfo:



from PyQt4.QtCore import *
from PyQt4.QtGui import *
import PyQt4.uic as uic
import sys

form_class, base_class = uic.loadUiType("Ui/histInfoDLG.ui")

class HistoryInformation(base_class, form_class):
def __init__(self, info, parent = None):
super(base_class, self).__init__(parent)
self.setupUi(self)

self.nameLabel.setText(info["name"])
self.pathLabel.setText(info["storage"])
self.urlLabel.setText(info["url"])

if __name__ == "__main__":
import sys

app = QApplication(sys.argv)
form = HistoryInformation({"name":"test", "storage":"test2", "url":"www.google.com"})
form.show()
app.exec_()


I have tested this with a different dialog and it worked fine, so the issue is with this dialog but I just cant see where it is, as if I run it on its own it works fine.

Any ideas?

Cheers.

supertom44
12th July 2010, 13:59
Turns out the error was occurring as the the ui file I created was for a widget not a dialog.

Sorry about this, I tried to delete the post, but couldn't, mods feel free to delete.

buddhog
10th November 2016, 18:58
Thanks, I had the same problem and couldn't figure it out!