anyplotlib.Widget#
- class anyplotlib.Widget(wtype, push_fn, **kwargs)[source]#
Bases:
_EventMixinBase class for all overlay widgets.
Provides attribute-based state access, callbacks for interaction events, and automatic synchronization with the JavaScript renderer.
- Parameters:
- callbacks#
Event callback registry. Register handlers via
widget.add_event_handler(fn, "pointer_move")or as a decorator:@widget.add_event_handler("pointer_move").Common event types:
"pointer_move"— fires on every drag frame"pointer_up"— fires once when drag settles"pointer_down"— fires on click/press event
- Type:
- set(_push=True, **kwargs)[source]#
Update properties and send targeted update to JavaScript.
- Parameters:
- Return type:
None
Notes
Updates are sent as targeted widget updates, not full panel re-renders. This is more efficient for frequent updates during dragging.
- to_dict()[source]#
Return a dict copy of the widget state.
- Returns:
All widget properties including id and type.
- Return type: