Python Forum
[PyQt] QTimer not activating function after timeout
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] QTimer not activating function after timeout
#1
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_())
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] About QTimer and QThread and some general question catlessness 1 2,619 Nov-02-2021, 07:20 PM
Last Post: deanhystad
  [PyQt] Using Qt to emit a signal (or maybe with QTimer) pyhill00 1 2,112 Oct-07-2021, 01:57 AM
Last Post: deanhystad
  [Tkinter] Activating buton using "Enter" key ybeco 3 6,964 Aug-01-2018, 01:52 PM
Last Post: ybeco

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020