Skip to content

ipygame.key

pygame-compatible key module.

class ScancodeWrapper(tuple)

Tuple subclass returned by get_pressed() — indexed by key constant.

def get_focused() -> bool

True when the display is receiving keyboard input.

def get_pressed() -> ScancodeWrapper

Get the state of all keyboard buttons.

def get_just_pressed() -> ScancodeWrapper

Get keys that were just pressed this frame.

def get_just_released() -> ScancodeWrapper

Get keys that were just released this frame.

def get_mods() -> int

Get the state of modifier keys.

def set_mods(mods: int) -> None

Set the state of modifier keys.

def set_repeat(delay: int = 0, interval: int = 0) -> None

Control how held keys are repeated.

def get_repeat() -> tuple[int, int]

Get the repeat delay and interval.

def name(key: int, use_compat: bool = True) -> str

Return the descriptive name of a key constant.

def key_code(name_str: str) -> int

Get the key constant from a descriptive name.

def start_text_input() -> None

Start receiving TEXTINPUT events.

def stop_text_input() -> None

Stop receiving TEXTINPUT events.

def set_text_input_rect(rect) -> None

Set the IME candidate list rectangle (no-op in ipygame).