Python Forum

Full Version: QTimer not activating function after timeout
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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_())