Source code for arcade.gui.events

from __future__ import annotations

from dataclasses import dataclass
from typing import Any


[docs] @dataclass class UIEvent: """ An event created by the GUI system. Can be passed using widget.dispatch("on_event", event). An event always has a source, which is the UIManager for general input events, but will be the specific widget in case of events like on_click events. """ source: Any
[docs] @dataclass class UIMouseEvent(UIEvent): """ Covers all mouse event """ x: float y: float @property def pos(self): return self.x, self.y
[docs] @dataclass class UIMouseMovementEvent(UIMouseEvent): """Triggered when the mouse is moved.""" dx: float dy: float
[docs] @dataclass class UIMousePressEvent(UIMouseEvent): """Triggered when a mouse button(left, right, middle) is pressed.""" button: int modifiers: int
[docs] @dataclass class UIMouseDragEvent(UIMouseEvent): """Triggered when the mouse moves while one of its buttons being pressed.""" dx: float dy: float buttons: int modifiers: int
[docs] @dataclass class UIMouseReleaseEvent(UIMouseEvent): """Triggered when a mouse button is released.""" button: int modifiers: int
[docs] @dataclass class UIMouseScrollEvent(UIMouseEvent): """Triggered by rotating the scroll wheel on the mouse.""" scroll_x: int scroll_y: int
[docs] @dataclass class UIKeyEvent(UIEvent): """Covers all keyboard event.""" symbol: int modifiers: int
[docs] @dataclass class UIKeyPressEvent(UIKeyEvent): """Triggered when a key is pressed.""" pass
[docs] @dataclass class UIKeyReleaseEvent(UIKeyEvent): """Triggered when a key is released.""" pass
[docs] @dataclass class UITextEvent(UIEvent): """Covers all the text cursor event.""" text: str
[docs] @dataclass class UITextMotionEvent(UIEvent): """Triggered when text cursor moves.""" motion: Any
[docs] @dataclass class UITextMotionSelectEvent(UIEvent): """Triggered when the text cursor moves selecting the text with it.""" selection: Any
[docs] @dataclass class UIOnClickEvent(UIMouseEvent): """Triggered when a button is clicked.""" pass
[docs] @dataclass class UIOnUpdateEvent(UIEvent): """ Arcade on_update callback passed as :class:`UIEvent` """ dt: int
[docs] @dataclass class UIOnChangeEvent(UIEvent): """ Value of a widget changed """ old_value: Any new_value: Any
[docs] @dataclass class UIOnActionEvent(UIEvent): """ Notification about an action :param action: Value describing the action, mostly a string """ action: Any