bootstack.events.Event#

class bootstack.events.Event(widget=None, x=0, y=0, x_root=0, y_root=0, width=0, height=0, delta=0, ctrl=False, shift=False, alt=False, meta=False, key='', char='', time=0)#

Bases: object

The object a handler receives for native and context events.

Native events carry no application payload — pointer clicks, hover, focus, blur, resize, key presses, and scrolling. For those, the handler bound with on_*() receives this curated Event: where the pointer was, the size of the widget, which modifier keys were held, and (for keyboard events) which key. Events that do carry data — change, input, select — hand the handler a typed payload object instead (see the rest of this module).

The fields are deliberately modern: modifier keys are plain booleans (ctrl, shift, alt, meta) and the key is a clean key string, with none of the low-level bitmask or serial-number plumbing of the underlying toolkit.

alt: bool#

Whether the Alt (Option on macOS) key was held.

char: str#

The character typed, for keyboard events. Empty if the key produced no character.

ctrl: bool#

Whether the Control key was held.

delta: int#

Scroll-wheel delta (positive = scroll up).

height: int#

Widget height at the time of the event.

key: str#

Symbolic name of the key, for keyboard events (e.g. "Return"). Empty for non-keyboard events.

meta: bool#

Whether the Meta key was held (Command on macOS, Super on Linux).

shift: bool#

Whether the Shift key was held.

time: int#

Event timestamp in milliseconds — useful for manual debounce/throttle.

widget: Any#

The widget that received the event.

width: int#

Widget width at the time of the event.

x: int#

Pointer x position relative to the widget.

x_root: int#

Pointer x position relative to the screen.

y: int#

Pointer y position relative to the widget.

y_root: int#

Pointer y position relative to the screen.