pyqt  

Re: [PyQt] Timers

Russell Valentine
Mon, 25 Jan 2010 21:52:28 -0800

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):
        QtGui.QMainWindow.__init__(self)


    def startProcessing(self):
        print "Processing"

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

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?


_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt