Input¶
Input ¶
is_key_just_pressed
staticmethod
¶
is_key_just_pressed(key: SupportsInt | SupportsIndex) -> bool
True only on the frame the key was pressed
is_key_pressed
staticmethod
¶
is_key_pressed(key: SupportsInt | SupportsIndex) -> bool
True every frame the key is held down
is_key_released
staticmethod
¶
is_key_released(key: SupportsInt | SupportsIndex) -> bool
True only on the frame the key was released
is_mouse_button_just_pressed
staticmethod
¶
is_mouse_button_just_pressed(button: SupportsInt | SupportsIndex) -> bool
True only on the frame the mouse button was pressed
is_mouse_button_pressed
staticmethod
¶
is_mouse_button_pressed(button: SupportsInt | SupportsIndex) -> bool
True every frame the mouse button is held down
is_mouse_button_released
staticmethod
¶
is_mouse_button_released(button: SupportsInt | SupportsIndex) -> bool
True only on the frame the mouse button was released
on_key_just_pressed
staticmethod
¶
on_key_just_pressed(key: SupportsInt | SupportsIndex, callback: Callable) -> tuple[int, int]
Fires once on the frame the key is pressed. Returns an id usable with remove_key_just_pressed_callback().
on_key_pressed
staticmethod
¶
on_key_pressed(key: SupportsInt | SupportsIndex, callback: Callable) -> tuple[int, int]
Fires every frame while the key is held. Returns an id usable with remove_key_pressed_callback().
on_key_released
staticmethod
¶
on_key_released(key: SupportsInt | SupportsIndex, callback: Callable) -> tuple[int, int]
Fires once on the frame the key is released. Returns an id usable with remove_key_released_callback().
on_mouse_button_just_pressed
staticmethod
¶
on_mouse_button_just_pressed(button: SupportsInt | SupportsIndex, callback: Callable) -> tuple[int, int]
Fires once on the frame the mouse button is pressed. Returns an id usable with remove_mouse_button_just_pressed_callback().
on_mouse_button_pressed
staticmethod
¶
on_mouse_button_pressed(button: SupportsInt | SupportsIndex, callback: Callable) -> tuple[int, int]
Fires every frame while the mouse button is held. Returns an id usable with remove_mouse_button_pressed_callback().
on_mouse_button_released
staticmethod
¶
on_mouse_button_released(button: SupportsInt | SupportsIndex, callback: Callable) -> tuple[int, int]
Fires once on the frame the mouse button is released. Returns an id usable with remove_mouse_button_released_callback().
remove_key_just_pressed_callback
staticmethod
¶
remove_key_just_pressed_callback(id: tuple[SupportsInt | SupportsIndex, SupportsInt | SupportsIndex]) -> None
Unregister a callback previously registered with on_key_just_pressed()
remove_key_pressed_callback
staticmethod
¶
remove_key_pressed_callback(id: tuple[SupportsInt | SupportsIndex, SupportsInt | SupportsIndex]) -> None
Unregister a callback previously registered with on_key_pressed()
remove_key_released_callback
staticmethod
¶
remove_key_released_callback(id: tuple[SupportsInt | SupportsIndex, SupportsInt | SupportsIndex]) -> None
Unregister a callback previously registered with on_key_released()
remove_mouse_button_just_pressed_callback
staticmethod
¶
remove_mouse_button_just_pressed_callback(id: tuple[SupportsInt | SupportsIndex, SupportsInt | SupportsIndex]) -> None
Unregister a callback previously registered with on_mouse_button_just_pressed()
remove_mouse_button_pressed_callback
staticmethod
¶
remove_mouse_button_pressed_callback(id: tuple[SupportsInt | SupportsIndex, SupportsInt | SupportsIndex]) -> None
Unregister a callback previously registered with on_mouse_button_pressed()
remove_mouse_button_released_callback
staticmethod
¶
remove_mouse_button_released_callback(id: tuple[SupportsInt | SupportsIndex, SupportsInt | SupportsIndex]) -> None
Unregister a callback previously registered with on_mouse_button_released()
Key ¶
Common GLFW key codes. Attributes are plain ints, e.g. Key.SPACE, Key.A .. Key.Z, Key.NUM_0 .. Key.NUM_9, usable anywhere an int key code is expected.
__all__
module-attribute
¶
__all__: list[str] = ['A', 'B', 'C', 'D', 'DOWN', 'E', 'ENTER', 'ESCAPE', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'LEFT', 'LEFT_ALT', 'LEFT_CONTROL', 'LEFT_SHIFT', 'M', 'N', 'NUM_0', 'NUM_1', 'NUM_2', 'NUM_3', 'NUM_4', 'NUM_5', 'NUM_6', 'NUM_7', 'NUM_8', 'NUM_9', 'O', 'P', 'Q', 'R', 'RIGHT', 'S', 'SPACE', 'T', 'U', 'UP', 'V', 'W', 'X', 'Y', 'Z']
Mouse ¶
Mouse button codes. Attributes are plain ints, e.g. Mouse.LEFT, Mouse.RIGHT, Mouse.MIDDLE, usable anywhere an int button code is expected.