ipyoverlay.mpl.event.MPLArtistEventHandler#
- class ipyoverlay.mpl.event.MPLArtistEventHandler(axes: matplotlib.axes._axes.Axes, callback: Callable, tolerance: float = 0.5, button: int = 1)#
Bases:
object
Methods
__init__
(axes, callback[, tolerance, button])connect
()Register the event handler and start listening for events.
Unregister this callback from the figure canvas and stop getting events.
Attributes
Which mouse button to listen for (by default left click.) Expects the matplotlib.backend_bases.MouseButton enum (for ease: 1 = left, 2 = middle, 3 = right)
Once attached, this is the cid of the callback once mpl_connect is called, used to disconnect this handler from the figure.
How far away from a point a click will still register as having clicked on that point.
The axes this event will be registered to.
The function to call when a point click is detected.
- Parameters:
axes (Axes) –
callback (Callable) –
tolerance (float) –
button (int) –
- axes: Axes#
The axes this event will be registered to. This filters out events from other axes within the same figure, use a separate event handler to listen to each desired axes.
- button: int = 1#
Which mouse button to listen for (by default left click.) Expects the matplotlib.backend_bases.MouseButton enum (for ease: 1 = left, 2 = middle, 3 = right)
- callback: Callable#
The function to call when a point click is detected. This function will be passed the index within the points_x/points_y that was nearest and the mpl event object.
- callback_id: int = None#
Once attached, this is the cid of the callback once mpl_connect is called, used to disconnect this handler from the figure. (Call
disconnect()
).
- connect()#
Register the event handler and start listening for events.
- disconnect()#
Unregister this callback from the figure canvas and stop getting events.
- tolerance: float = 0.5#
How far away from a point a click will still register as having clicked on that point.