academy.event¶
or_event
¶
Create a combined event that is set when any input events are set.
Note
The creator can wait on the combined event, but must still check each individual event to see which was set.
Warning
This works by dynamically replacing methods on the inputs events with custom methods that trigger callbacks.
Note
Based on this Stack Overflow answer.
Parameters:
-
events
(Event
, default:()
) –One or more events to combine.
Returns:
-
Event
–A single event that is set when any of the input events is set.
Source code in academy/event.py
wait_event_async
async
¶
Wait for the first async event to be set.
Parameters:
-
events
(Event
, default:()
) –One or more events to wait on.
-
timeout
(float | None
, default:None
) –Maximum number of seconds to wait for an event to finish.
Returns:
-
Event
–The first event to finish.
Raises:
-
TimeoutError
–If no event finished within
timeout
seconds.