matplotlib.widgets.Button#
- class matplotlib.widgets.Button(ax, label, image=None, color='0.85', hovercolor='0.95', *, useblit=True)[source]#
Bases:
AxesWidgetA GUI neutral button.
For the button to remain responsive you must keep a reference to it. Call
on_clickedto connect to the button.- Attributes:
- Parameters:
- ax
Axes The
Axesinstance 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
imshow.- colorcolor
The color of the button when not activated.
- hovercolorcolor
The color of the button when the mouse is over it.
- useblitbool, default: True
Use blitting for faster drawing if supported by the backend. See the tutorial Faster rendering by using blitting for details.
Added in version 3.7.
- ax