[PyQt] Problem with QTimeLine

Juan Pablo Romero Méndez jpablo.romero at gmail.com
Mon Aug 10 05:22:47 BST 2009


Hello all,

running the following code produces 1,2 the first time and 0,1,2 on
subsecuent clicks. ¿Is this correct?

if __name__ == "__main__":
    import sys
    from PyQt4 import QtGui, QtCore
    app = QtGui.QApplication(sys.argv)
    tl = QtCore.QTimeLine(1000)
    tl.setFrameRange(0,2)
    def fn(n): print n
    QtCore.QObject.connect(tl,QtCore.SIGNAL("frameChanged(int)"), fn)
    b = QtGui.QPushButton("correr")
    b.show()
    QtCore.QObject.connect(b,QtCore.SIGNAL("clicked(bool)"), tl.start)
    sys.exit(app.exec_())

Regards,

 Juan Pablo



More information about the PyQt mailing list