Reputation: 3917
Is there an easy way in Qt to add a function to the standard Qt mainloop (exec()
)? Ideally something like how it would be done in GTK:
import gobject
gobject.timeout_add(milliseconds, callback)
I need this for a simple GUI which just grabs and displays a video feed from a camera.
Upvotes: 2
Views: 792
Reputation: 40512
Use QTimer
:
timer = QTimer()
timer.timeout.connect(callback)
timer.start(msecs)
For single-shot timeouts, you can use the singleShot
class method directly:
QTimer.singleShot(msecs, callback);
Upvotes: 5