[PyQt] Timers

Russell Valentine russ at coldstonelabs.org
Tue Jan 26 05:51:36 GMT 2010

Seems to work for me, and if it usually works for you, then it is 
probably what you didn't include in your email that is not working?

#Does it for me
from PyQt4 import QtCore, QtGui
import sys

class Main(QtGui.QMainWindow):
     def __init__(self):

     def startProcessing(self):
         print "Processing"

if __name__=="__main__":
     a = QtGui.QApplication(sys.argv)
     m = Main()
     QtCore.QTimer.singleShot(0, m.startProcessing)

Jason H wrote:
> I have a class that is created and needs to run a function after the event loop starts.
> Usually I just do:
> if __name__=="__main__":
>     a = QApplication(sys.argv)
>     m=Main(False)
>     m.show()
>     QTimer.singleShot(0, m.startProcessing)
>     a.exec_()
> But my startProcessing slot does not get called.
> Ideas?

More information about the PyQt mailing list