event
pykraken.event Input event handling
At a glance
7 membersReference
PYTHON APInew_custom
functionnew_custom() -> EventCreate a new custom event type.
Returns
- Event — The newly registered custom Event.
Raises
- RuntimeError — If registration fails.
poll
functionpoll() -> list[Event]Poll for all pending user input events.
This clears input states and returns a list of events that occurred since the last call.
Returns
list[Event]: A list of input event objects.
push
functionpush(event: Event) -> NonePush a custom event to the event queue.
Args
- event (
Event) — The custom event to push to the queue.
Raises
- ValueError — If the event is not a custom event type.
- RuntimeError — If the event could not be queued.
schedule
functionschedule(event: Event, delay_ms: int, repeat: bool = False) -> NoneSchedule a custom event to be pushed after a delay. Will overwrite any existing timer for the same event.
Args
- event (
Event) — The custom event to schedule. - delay_ms (
int) — Delay in milliseconds before the event is pushed. - repeat (
bool, optional) — If True, the event will be pushed repeatedly at the specified interval. If False, the event is pushed only once. Defaults to False.
Raises
- ValueError — If the event is not a custom event type.
- RuntimeError — If the timer could not be created.
start_text_input
functionstart_text_input() -> NoneStart text input for TEXT_INPUT and TEXT_EDITING events.
Raises
- RuntimeError — If text input could not be started.
stop_text_input
functionstop_text_input() -> NoneStop text input for TEXT_INPUT and TEXT_EDITING events.
Raises
- RuntimeError — If text input could not be stopped.
unschedule
functionunschedule(event: Event) -> NoneCancel a scheduled event timer.
Args
- event (
Event) — The custom event whose timer should be cancelled.