[PyQt] Help with PyQt5 QThread parent argument

David Cortesi davecortesi at gmail.com
Fri Jan 17 00:26:03 GMT 2014

I have a QThread subclass that begins so:

> class WorkerBee ( QThread ) :
>     statusChanged = pyqtSignal(int, int)
>     def __init__(self, parent=None):
>          super().__init__(parent)

In PyQt4 I instantiate this from a QMainWindow with:

>  self.worker = WorkerBee() # i.e. no parent

In PyQt5 (5.2, sip 4.15.4) this produces the error,

builtins.TypeError: descriptor '__init__' requires a
'sip.simplewrapper' object but received a 'NoneType'

However if I pass the main window as parent,

>  self.worker = WorkerBee(self)

I then get the error,

builtins.AttributeError: 'theAppWindow' object has no attribute 'run'

Per the PyQt4 reference and the Qt5 C++ reference, the parent argument
should be a QObject and anyway is optional. What am I doing wrong?

Thanks for your time,
Dave Cortesi

More information about the PyQt mailing list