71. gui.timer
—¶
- class gui.timer.Timer(sec, func, repeat=False, start=True)[source]¶
A wrapper class over the
QTimer
.The Timer waits a given amount of time and then executes some code.
- Parameters:
sec (float) – Time in seconds to wait before running func.
func (callable) – Function to execute after sec seconds.
repeat (bool) – If True, the execution of func will be repeated every sec seconds. The default is to execute only once.
start (bool) – If True (default), the Timer is started immediately when created. It may be set to False to create a Timer that will be started later.
Notes
Keep the Timer bound to a variable, so that it is not destroyed before it has executed. QTimer methods like start, stop can be used to (re)start or stop an existing Timer.