Python Forum
[PyQt] QTimer not activating function after timeout - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [PyQt] QTimer not activating function after timeout (/thread-2700.html)



QTimer not activating function after timeout - LavaCreeperKing - Apr-03-2017

I need to be able to use the QTimer, but I can't get it to work. It seems to not be calling the function I want it to after the time runs out or it just is not running all together. I'm not sure which.

from PyQt4 import QtCore, QtGui
import sys

def test():
    print('test')

timer = QtCore.QTimer()
timer.timeout.connect(test)
timer.start(300)

app = QtGui.QApplication(sys.argv)
sys.exit(app.exec_())