Source code for arcade.gui.events

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): dx: float dy: float
[docs]@dataclass class UIMousePressEvent(UIMouseEvent): button: int modifiers: int
[docs]@dataclass class UIMouseDragEvent(UIMouseEvent): dx: float dy: float buttons: int modifiers: int
[docs]@dataclass class UIMouseReleaseEvent(UIMouseEvent): button: int modifiers: int
[docs]@dataclass class UIMouseScrollEvent(UIMouseEvent): scroll_x: int scroll_y: int
[docs]@dataclass class UIKeyEvent(UIEvent): symbol: int modifiers: int
[docs]@dataclass class UIKeyPressEvent(UIKeyEvent): pass
[docs]@dataclass class UIKeyReleaseEvent(UIKeyEvent): pass
[docs]@dataclass class UITextEvent(UIEvent): text: str
[docs]@dataclass class UITextMotionEvent(UIEvent): motion: Any
[docs]@dataclass class UITextMotionSelectEvent(UIEvent): selection: Any
[docs]@dataclass class UIOnClickEvent(UIMouseEvent): 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