Skip to content

ipygame.event

pygame-compatible event module.

class Event()

Represents a single event, compatible with pygame.event.Event.

def __init__(event_type: int, attributes: dict | None = None, **kwargs)

@property
def dict() -> dict

def pump() -> None

Internal processing — no-op in ipygame (events arrive via callbacks).

def get(eventtype=None, pump: bool = True, exclude=None) -> list[Event]

Get and remove events from the queue.

eventtype can be a single type int, a sequence of types, or None (all events).

def poll() -> Event

Get a single event from the queue (or NOEVENT).

def wait(timeout: int = 0) -> Event

Wait for an event. In Jupyter this just polls (blocking not advisable).

def peek(eventtype=None) -> bool

Return True if there are events of the given type in the queue.

def clear(eventtype=None) -> None

Remove events from the queue.

def post(event: Event) -> bool

Place an event on the queue.

def event_name(event_type: int) -> str

Return a human-readable name for event_type.

def set_blocked(event_type) -> None

def set_allowed(event_type) -> None

def get_blocked(event_type: int) -> bool

def set_grab(grab: bool) -> None

def get_grab() -> bool

def custom_type() -> int

Allocate and return a unique event type id.