smpl.plot.Button¶
- class smpl.plot.Button(ax, label, image=None, color='0.85', hovercolor='0.95')[source]¶
Bases:
AxesWidgetA GUI neutral button.
For the button to remain responsive you must keep a reference to it. Call .on_clicked to connect to the button.
Attributes¶
- ax
The matplotlib.axes.Axes the button renders into.
- label
A matplotlib.text.Text instance.
- color
The color of the button when not hovering.
- hovercolor
The color of the button when hovering.
- __init__(ax, label, image=None, color='0.85', hovercolor='0.95')[source]¶
Parameters¶
- ax~matplotlib.axes.Axes
The ~.axes.Axes instance the button will be placed into.
- labelstr
The button text.
- imagearray-like or PIL Image
The image to place in the button, if not None. The parameter is directly forwarded to ~matplotlib.axes.Axes.imshow.
- colorcolor
The color of the button when not activated.
- hovercolorcolor
The color of the button when the mouse is over it.
Methods
__init__(ax, label[, image, color, hovercolor])Parameters ax ~matplotlib.axes.Axes The ~.axes.Axes instance the button will be placed into. label str The button text. image array-like or PIL Image The image to place in the button, if not None. The parameter is directly forwarded to ~matplotlib.axes.Axes.imshow. color color The color of the button when not activated. hovercolor color The color of the button when the mouse is over it.
connect_event(event, callback)Connect a callback function with an event.
disconnect(cid)Remove the callback function with connection id cid.
Disconnect all events created by this widget.
Get whether the widget is active.
ignore(event)Return whether event should be ignored.
on_clicked(func)Connect the callback function func to button click events.
set_active(active)Set whether the widget is active.
Attributes
Is the widget active?
drawoneventson- property active¶
Is the widget active?
- connect_event(event, callback)¶
Connect a callback function with an event.
This should be used in lieu of
figure.canvas.mpl_connectsince this function stores callback ids for later clean up.
- disconnect_events()¶
Disconnect all events created by this widget.
- get_active()¶
Get whether the widget is active.
- ignore(event)¶
Return whether event should be ignored.
This method should be called at the beginning of any event callback.
- on_clicked(func)[source]¶
Connect the callback function func to button click events.
Returns a connection id, which can be used to disconnect the callback.
- set_active(active)¶
Set whether the widget is active.