[PyQt] OSX and threads

Phil Thompson phil at riverbankcomputing.co.uk
Sun Jun 10 00:11:57 BST 2007


On Saturday 09 June 2007 11:35 pm, Kovid Goyal wrote:
> Hi,
>
> The following test code gives me an error on OSX but not on either windows
> or linux:
> from PyQt4.Qt import *
> import sys
> class test(QObject):
>   def __init__(self, window):
>     QObject.__init__(self)
>     self.window = window
>     self.startTimer(1000)
>     window.show()
>
> app = QApplication(sys.argv)
> window = QMainWindow()
> test(window)
> app.exec_()
>
> The error is:
> QObject::startTimer: QTimer can only be used with threads started with
> QThread
>
> What am I doing wrong?

Not keeping a reference to the test instance?

Phil


More information about the PyQt mailing list