anyplotlib.Event#

class anyplotlib.Event(event_type, source=None, time_stamp=<factory>, modifiers=<factory>, x=None, y=None, button=None, buttons=0, xdata=None, ydata=None, ray=None, line_id=None, dwell_ms=None, bar_index=None, value=None, x_label=None, group_index=None, dx=None, dy=None, zoom=None, center_x=None, center_y=None, image_width=None, image_height=None, display_width=None, display_height=None, azimuth=None, elevation=None, key=None, last_widget_id=None, source_panel_id=None, target_panel_id=None, inset_id=None, anchor=None, w_frac=None, h_frac=None, target=None, stop_propagation=False)[source]#

Bases: object

A single interactive event with all payload fields as typed attributes.

Universal fields (every event):

event_type, source, time_stamp, modifiers

Pointer fields (pointer_* and double_click events):

x, y — canvas coordinates within the panel (float pixels) button — 0=left 1=middle 2=right; None on move/enter/leave/settled buttons — bitmask of currently held buttons xdata, ydata — data-space coordinates (None for Plot3D) ray — Plot3D only: {“origin”: […], “direction”: […]} line_id — Plot1D only: set when pointer is over a line dwell_ms — pointer_settled only: actual dwell time target — double_click only: hit chrome element, or None for plot-area (title/x_label/x_ticks/y_label/y_ticks/colorbar_label/legend)

PlotBar extra fields (pointer_down only):

bar_index, value, x_label, group_index

Wheel fields:

dx, dy — scroll deltas

Key fields:

key — key name e.g. “q”, “Enter”, “ArrowLeft” last_widget_id — id of the last widget the user clicked, or None

Panel-swap fields (figure-level panel_swap events):

source_panel_id, target_panel_id — the two panel ids dragged between

Inset drag/resize fields (figure-level inset_geometry_change events):

inset_id — the inset panel id anchor — new top-left position [fx, fy] in figure fractions w_frac, h_frac — new size in figure fractions

Propagation:

stop_propagation — set True inside a handler to halt remaining handlers

Parameters:
  • event_type (str)

  • source (Any)

  • time_stamp (float)

  • modifiers (list[str])

  • x (float | None)

  • y (float | None)

  • button (int | None)

  • buttons (int)

  • xdata (float | None)

  • ydata (float | None)

  • ray (dict | None)

  • line_id (str | None)

  • dwell_ms (float | None)

  • bar_index (int | None)

  • value (float | None)

  • x_label (str | None)

  • group_index (int | None)

  • dx (float | None)

  • dy (float | None)

  • zoom (float | None)

  • center_x (float | None)

  • center_y (float | None)

  • image_width (int | None)

  • image_height (int | None)

  • display_width (int | None)

  • display_height (int | None)

  • azimuth (float | None)

  • elevation (float | None)

  • key (str | None)

  • last_widget_id (str | None)

  • source_panel_id (str | None)

  • target_panel_id (str | None)

  • inset_id (str | None)

  • anchor (list | None)

  • w_frac (float | None)

  • h_frac (float | None)

  • target (str | None)

  • stop_propagation (bool)

event_type: str#
source: Any = None#
time_stamp: float#
modifiers: list[str]#
x: float | None = None#
y: float | None = None#
button: int | None = None#
buttons: int = 0#
xdata: float | None = None#
ydata: float | None = None#
ray: dict | None = None#
line_id: str | None = None#
dwell_ms: float | None = None#
bar_index: int | None = None#
value: float | None = None#
x_label: str | None = None#
group_index: int | None = None#
dx: float | None = None#
dy: float | None = None#
zoom: float | None = None#
center_x: float | None = None#
center_y: float | None = None#
image_width: int | None = None#
image_height: int | None = None#
display_width: int | None = None#
display_height: int | None = None#
azimuth: float | None = None#
elevation: float | None = None#
key: str | None = None#
last_widget_id: str | None = None#
source_panel_id: str | None = None#
target_panel_id: str | None = None#
inset_id: str | None = None#
anchor: list | None = None#
w_frac: float | None = None#
h_frac: float | None = None#
target: str | None = None#
stop_propagation: bool = False#