Results 1 to 3 of 3

Thread: pyqt New Dialog No Attribute exec_

  1. #1
    Join Date
    Jul 2010
    Posts
    2
    Thanked 1 Time in 1 Post
    Qt products
    Platforms
    Windows

    Question pyqt New Dialog No Attribute exec_

    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:
    Qt Code:
    1. histinfodlg = histInfo.HistoryInformation(nzb, form)
    2. histinfodlg.exec_()
    To copy to clipboard, switch view to plain text mode 

    Here is the code for the histInfo:
    Qt Code:
    1. from PyQt4.QtCore import *
    2. from PyQt4.QtGui import *
    3. import PyQt4.uic as uic
    4. import sys
    5.  
    6. form_class, base_class = uic.loadUiType("Ui/histInfoDLG.ui")
    7.  
    8. class HistoryInformation(base_class, form_class):
    9. def __init__(self, info, parent = None):
    10. super(base_class, self).__init__(parent)
    11. self.setupUi(self)
    12.  
    13. self.nameLabel.setText(info["name"])
    14. self.pathLabel.setText(info["storage"])
    15. self.urlLabel.setText(info["url"])
    16.  
    17. if __name__ == "__main__":
    18. import sys
    19.  
    20. app = QApplication(sys.argv)
    21. form = HistoryInformation({"name":"test", "storage":"test2", "url":"www.google.com"})
    22. form.show()
    23. app.exec_()
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Jul 2010
    Posts
    2
    Thanked 1 Time in 1 Post
    Qt products
    Platforms
    Windows

    Default Re: pyqt New Dialog No Attribute exec_

    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.

  3. The following user says thank you to supertom44 for this useful post:

    buddhog (10th November 2016)

  4. #3
    Join Date
    Oct 2016
    Posts
    2
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: pyqt New Dialog No Attribute exec_

    Thanks, I had the same problem and couldn't figure it out!

Similar Threads

  1. Multi-dialog program in PyQT will not close
    By Danny Hatt in forum Qt Programming
    Replies: 1
    Last Post: 21st November 2010, 23:12
  2. Multi-dialog program in PyQT will not close (the sequel!)
    By Danny Hatt in forum Qt Programming
    Replies: 0
    Last Post: 19th June 2010, 02:05
  3. Replies: 1
    Last Post: 12th August 2009, 01:00
  4. Updating xml attribute
    By steg90 in forum Qt Programming
    Replies: 3
    Last Post: 17th July 2007, 10:26
  5. Replies: 1
    Last Post: 22nd January 2007, 10:41

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.