[PyQt] Problem with class inheriting QDialog

dizou di_zou at yahoo.com
Thu Nov 19 21:45:31 GMT 2009


I have a class Dialog inheriting a QDialog:

def Dialog(QDialog):
	def __init__(self, parent):
		QDialog.__init__(self, parent)

I have a MainWindow class that inherits QMainWindow that creates the Dialog
class:

class MainWindow(QMainWindow):
    def __init__(self):
        #stuff
    def MyFunction():
        dialog = Dialog(self)
        print type(dialog)
        dialog.exec_()

When MyFunction is called I get this output and error:

<type 'NoneType'>
...
AttributeError: 'NoneType' object has no attribute 'exec_'

I guess the QDialog isn't being initialized right? How do I fix this?
-- 
View this message in context: http://old.nabble.com/Problem-with-class-inheriting-QDialog-tp26421493p26421493.html
Sent from the PyQt mailing list archive at Nabble.com.



More information about the PyQt mailing list