[PyQt] doubt with QtCore.QThread

Phil Thompson phil at riverbankcomputing.co.uk
Tue Oct 2 16:02:34 BST 2007


On Tuesday 02 October 2007, Pradnyesh Sawant wrote:
> Hello,
> I have this code, which seems to be correct, but will not run :((
> ##################################################
> import sys
> from PyQt4 import QtCore, QtGui
> class Tmp(QtGui.QDialog, QtCore.QThread):
>     def __init__(self, parent = None):
>         QtGui.QDialog.__init__(self, parent)
>         QtCore.QThread.__init__(self)
>     def run(self):
>         print 'Test inside run :)'####
>
> if __name__ == '__main__':
>     app = QtGui.QApplication(sys.argv)
>     t = Tmp()
>     t.show()
>     t.start()
>     sys.exit(app.exec_())
> ##################################################
> the error it gives is:
> AttributeError: start
> although, 'print dir(t)' shows start to be an element of t

You can't use multiple inheritance with more than one Qt class.

Phil


More information about the PyQt mailing list