Skip to content

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']

A module-attribute

A: int = 65

B module-attribute

B: int = 66

C module-attribute

C: int = 67

D module-attribute

D: int = 68

DOWN module-attribute

DOWN: int = 264

E module-attribute

E: int = 69

ENTER module-attribute

ENTER: int = 257

ESCAPE module-attribute

ESCAPE: int = 256

F module-attribute

F: int = 70

G module-attribute

G: int = 71

H module-attribute

H: int = 72

I module-attribute

I: int = 73

J module-attribute

J: int = 74

K module-attribute

K: int = 75

L module-attribute

L: int = 76

LEFT module-attribute

LEFT: int = 263

LEFT_ALT module-attribute

LEFT_ALT: int = 342

LEFT_CONTROL module-attribute

LEFT_CONTROL: int = 341

LEFT_SHIFT module-attribute

LEFT_SHIFT: int = 340

M module-attribute

M: int = 77

N module-attribute

N: int = 78

NUM_0 module-attribute

NUM_0: int = 48

NUM_1 module-attribute

NUM_1: int = 49

NUM_2 module-attribute

NUM_2: int = 50

NUM_3 module-attribute

NUM_3: int = 51

NUM_4 module-attribute

NUM_4: int = 52

NUM_5 module-attribute

NUM_5: int = 53

NUM_6 module-attribute

NUM_6: int = 54

NUM_7 module-attribute

NUM_7: int = 55

NUM_8 module-attribute

NUM_8: int = 56

NUM_9 module-attribute

NUM_9: int = 57

O module-attribute

O: int = 79

P module-attribute

P: int = 80

Q module-attribute

Q: int = 81

R module-attribute

R: int = 82

RIGHT module-attribute

RIGHT: int = 262

S module-attribute

S: int = 83

SPACE module-attribute

SPACE: int = 32

T module-attribute

T: int = 84

U module-attribute

U: int = 85

UP module-attribute

UP: int = 265

V module-attribute

V: int = 86

W module-attribute

W: int = 87

X module-attribute

X: int = 88

Y module-attribute

Y: int = 89

Z module-attribute

Z: int = 90

Mouse

Mouse button codes. Attributes are plain ints, e.g. Mouse.LEFT, Mouse.RIGHT, Mouse.MIDDLE, usable anywhere an int button code is expected.

__all__ module-attribute

__all__: list[str] = ['LEFT', 'MIDDLE', 'RIGHT']

LEFT module-attribute

LEFT: int = 0

MIDDLE module-attribute

MIDDLE: int = 2

RIGHT module-attribute

RIGHT: int = 1