matplotlib.widgets._Buttons#
- classmatplotlib.widgets._Buttons(ax,labels,*,useblit=True,label_props=None,layout=None,**kwargs)[source]#
Bases:
AxesWidgetThe base class for
CheckButtonsandRadioButtons.This class provides common functionality for button widgets,such as handling click events, managing button labels, and connecting callbacks.
The class itself is private and may be changed or removed without prior warning.However, the public API it provides to subclasses is stable and consideredpublic on the subclasses.
- on_clicked(func)[source]#
Connect the callback functionfunc to button click events.
- Parameters:
- funccallable
When the button is clicked, callfunc with button label.When all buttons are cleared, callfunc with None.The callback func must have the signature:
deffunc(label:str|None)->Any
Return values may exist, but are ignored.
- Returns:
- A connection id, which can be used to disconnect the callback.
- set_label_props(props)[source]#
Set properties of the
Textlabels.Added in version 3.7.
- Parameters:
- propsdict
Dictionary of
Textproperties to be used for the labels. Sameformat as label_props argument ofRadioButtonsorCheckButtons.