matplotlib.widgets._SelectorWidget#
- class matplotlib.widgets._SelectorWidget(ax, onselect=None, useblit=False, button=None, state_modifier_keys=None, use_data_coordinates=False)[source]#
Bases:
AxesWidgetThe base class for selector widgets.
This class provides common functionality for selector widgets, such as handling mouse and keyboard events, managing state modifier keys, etc.
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 considered public on the subclasses.
- add_state(state)[source]#
Add a state to define the widget's behavior. See the state_modifier_keys parameter in the constructor of the concrete selector class for details.
- Parameters:
- statestr
Must be a supported state of the selector. See the state_modifier_keys parameter in the constructor of the concrete selector class for details.
- Raises:
- ValueError
When the state is not supported by the selector.
- property artists#
Tuple of the artists of the selector.
- ignore(event)[source]#
Return whether event should be ignored.
This method should be called at the beginning of any event callback.
- remove_state(state)[source]#
Remove a state to define the widget's behavior. See the state_modifier_keys parameter in the constructor of the concrete selector class for details.
- Parameters:
- statestr
Must be a supported state of the selector. See the state_modifier_keys parameter in the constructor of the concrete selector class for details.
- Raises:
- ValueError
When the state is not supported by the selector.
- set_handle_props(**handle_props)[source]#
Set the properties of the handles selector artist. See the handle_props argument in the selector docstring to know which properties are supported.
- set_props(**props)[source]#
Set the properties of the selector artist.
See the props argument in the selector docstring to know which properties are supported.
- property useblit#
Return whether blitting is used (requested and supported by canvas).
Examples using matplotlib.widgets._SelectorWidget#
Select indices from a collection using polygon selector