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 UIMouseDragEvent(UIMouseEvent):
dx: float
dy: float
buttons: int
modifiers: int
[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