textual.timer
Contains the Timer
class.
Timer objects are created by set_interval or
set_timer.
TimerCallback
module-attribute
¶
Type of valid callbacks to be used with timers.
EventTargetGone
¶
Bases: Exception
Raised if the timer event target has been deleted prior to the timer event being sent.
Timer
¶
A class to send timer-based events.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
MessageTarget
|
The object which will receive the timer events. |
required |
|
float
|
The time between timer events, in seconds. |
required |
|
str | None
|
A name to assign the event (for debugging). |
None
|
|
TimerCallback | None
|
A optional callback to invoke when the event is handled. |
None
|
|
int | None
|
The number of times to repeat the timer, or None to repeat forever. |
None
|
|
bool
|
Enable skipping of scheduled events that couldn't be sent in time. |
True
|
|
bool
|
Start the timer paused. |
False
|
stop
¶
Stop the timer.
Returns:
Type | Description |
---|---|
None
|
A Task object. Await this to wait until the timer has completed. |