Events

Keys, mouse and files, and the polling functions.

Key

Key()

Codes of the non-printable keys.

Printable keys have no member: their code is the character they type, so key == ord("a") and shift gives ord("A").

MouseButton

MouseButton()

Mouse buttons: LEFT 0, MIDDLE 1 and RIGHT 2.

KeyEvent

KeyEvent(key, keycode=0, scancode=0, modifiers=0)

A key press or release.

Attributes

Name Type Description
key int The key code: a Key member, or the typed character’s code.
keycode int The GLFW key code of the physical key, independent of shift.
scancode int The raw platform scancode.
modifiers int The modifier keys held, as bits: Key.SHIFT, Key.CONTROL, Key.ALT and Key.SUPER (Key.COMMAND), so event.modifiers & kiln.Key.COMMAND tests for Command. Lock keys (Caps Lock, Num Lock) are not included.

MouseEvent

MouseEvent(x, y, button=-1, scroll_x=0.0, scroll_y=0.0, modifiers=0)

A mouse event.

Attributes

Name Type Description
x float Mouse x in window points.
y float Mouse y in window points.
button int The button involved, or -1 for moves and scrolls.
scroll_x float Horizontal scroll amount, 0 for other events.
scroll_y float Vertical scroll amount, 0 for other events.
modifiers int The modifier keys held, as bits (see KeyEvent.modifiers).

DropInfo

DropInfo(files=list(), position=(0.0, 0.0))

Files dropped on the window.

Attributes

Name Type Description
files list[str] Paths of the dropped files.
position tuple[float, float] Where the files were dropped, in window points.

mouse

mouse

keys

keys