[PyQt] problem with qtimer

Pradnyesh Sawant spradml at gmail.com
Thu Dec 13 06:16:34 GMT 2007


Hello,
I have the following code snippet which works fine with sleep, but does not
do the intended thing with qtimer; I'll be grateful if someone could help
me out:

***************************************************************************
#!/usr/bin/env python

from time import sleep
import sys
from PyQt4 import QtGui, QtCore

class Jrnl(QtGui.QDialog):
    def __init__(self, parent = None):
        QtGui.QDialog.__init__(self, parent)

        self.createFe()
        self.showFe()
    def createFe(self):
        # create widgets, layout, connections, etc
        pass
    def showFe(self):
        self.show()
        sleep(1)
        jrnl = Jrnl()
        #################### 
        # The problem occurs if I replace the above 2 lines with 
        # the 4 lines below
        #################### 
        """ tmr = QtCore.QTimer(self)
        QtCore.QObject.connect(tmr, QtCore.SIGNAL("timeout()"), 
                self.newJrnl)
        tmr.start(1000) """
    def newJrnl(self):
        jrnl = Jrnl()

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    jrnl = Jrnl()
    sys.exit(app.exec_())
***************************************************************************

Basically, I want to replace sleep with qtimer, coz when the app enters
sleep, none of the created dialogs are refreshed (and appear to be hanged)
-- 
warm regards,
Pradnyesh Sawant
--
Always glad to share my ignorance - I've got plenty. --Anon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20071213/178ff9e5/attachment.bin


More information about the PyQt mailing list