WindowEvent¶
Import: import system.window;
Read the usage guide for examples and common tasks. This reference lists the public declarations for this part of the library. See Reading API signatures for parameter and result notation.
WindowEvent¶
Something that happened to a window since the previous Window.poll. InputFrame.events lists events in the order the operating system or browser reported them, followed by events queued with Window.simulate.
Resized¶
The drawable area changed size. The size is in physical pixels, which is the size a GPU surface needs; it differs from Window.size on high-DPI displays.
Moved¶
The window moved; x and y are the new top-left corner in screen coordinates. Browsers never report this event.
Focused¶
The window gained keyboard focus.
Unfocused¶
The window lost keyboard focus. Every held key and mouse button is reported released first, so input never sticks while the window is in the background.
CloseRequested¶
The user asked to close the window, for example with its close button. Window.is_open is false after the poll that delivers this event.
KeyDown¶
A key went down, or the operating system repeated a held key.
KeyUp¶
A key was released.
Text¶
Text the user typed, after the keyboard layout, dead keys and input-method composition were applied. Consecutive characters arrive as one event.
MouseMove¶
The cursor moved to position, in window coordinates.
MouseDown¶
A mouse button went down.
MouseUp¶
A mouse button was released.
Scroll¶
The wheel or touchpad scrolled. One wheel notch is 1.0; positive y scrolls up and positive x scrolls right.
GamepadConnected¶
A gamepad was connected in slot. Gamepads already connected when the window opens are reported in the first poll.
GamepadDisconnected¶
The gamepad in slot was disconnected.
FileDropped¶
A file was dropped on the window. Native programs receive its full path; browsers only reveal the file name.