MODULE v1.8.0

event

pykraken.event

Input event handling

Reference

PYTHON API

new_custom

function
new_custom() -> Event

Create a new custom event type.

Returns

  • Event — The newly registered custom Event.

Raises

  • RuntimeError — If registration fails.

poll

function
poll() -> 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

function
push(event: Event) -> None

Push 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

function
schedule(event: Event, delay_ms: int, repeat: bool = False) -> None

Schedule 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() -> None

Start text input for TEXT_INPUT and TEXT_EDITING events.

Raises

  • RuntimeError — If text input could not be started.
stop_text_input() -> None

Stop text input for TEXT_INPUT and TEXT_EDITING events.

Raises

  • RuntimeError — If text input could not be stopped.

unschedule

function
unschedule(event: Event) -> None

Cancel a scheduled event timer.

Args

  • event (Event) — The custom event whose timer should be cancelled.

Find your next step

Start typing to search the manual.