Event

Input event handling


New Custom

new_custom() Event

Create a new custom event type.

Returns

Event : The newly registered custom Event.

Raises

  • RuntimeError : If registration fails.

Poll

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

push(event: Event) None

Push a custom event to the event queue.

Args

  • 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

schedule(
    event: Event,
    delay_ms: SupportsInt,
    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 : The custom event to schedule.
  • delay_ms : Delay in milliseconds before the event is pushed.
  • repeat : 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

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

stop_text_input() None

Stop text input for TEXT_INPUT and TEXT_EDITING events.

Raises

  • RuntimeError : If text input could not be stopped.

Unschedule

unschedule(event: Event) None

Cancel a scheduled event timer.

Args

  • event : The custom event whose timer should be cancelled.