[PyQt] Problem with class inheriting QDialog

David Douard david.douard at logilab.fr
Fri Nov 20 17:03:45 GMT 2009


Looks like you are not calling QMainWindow base constructor.


Le Friday 20 November 2009 17:44:30 dizou, vous avez écrit :
> Dialog.py:
>
> import sys
> from PyQt4.QtGui import QDialog
>
> def Dialog(QDialog):
> 	def __init__(self, parent):
> 		QDialog.__init__(self, parent)
>
> MainWindow.py:
>
> from PyQt4.QtCore import SIGNAL, SLOT, QDir, QFile
> from PyQt4.QtGui import QApplication, QMainWindow, QMenu, QMessageBox, \
>      QWidget, qApp, QAction, QFileDialog, QPushButton
> from Dialog import *
>
> class MainWindow(QMainWindow):
>     def __init__(self):

          QMainWindow.__init__(self)

>         #stuff
>         self.editButton = QPushButton(self)
>         self.connect(self.editButton, SIGNAL("clicked()"),
> self.EditButtonClicked)
>     def EditButtonClicked(self):
>         self.dialog = Dialog(self)
>         print type(self.dialog)
>         self.dialog.exec_()



-- 
David Douard                        LOGILAB, Paris (France), +33 1 45 32 03 12
Formations Python, Zope, Debian :   http://www.logilab.fr/formations
Développement logiciel sur mesure : http://www.logilab.fr/services
Informatique scientifique :         http://www.logilab.fr/science



More information about the PyQt mailing list