matplotlib.backend_managers#
- class matplotlib.backend_managers.ToolEvent(name, sender, tool, data=None)[source]#
Bases:
objectEvent for tool manipulation (add/remove).
- class matplotlib.backend_managers.ToolManager(figure=None)[source]#
Bases:
objectManager for actions triggered by user interactions (key press, toolbar clicks, ...) on a Figure.
- Attributes:
- property active_toggle#
Currently toggled tools.
- add_tool(name, tool, *args, **kwargs)[source]#
Add tool to
ToolManager.If successful, adds a new event
tool_trigger_{name}where{name}is the name of the tool; the event is fired every time the tool is triggered.- Parameters:
- namestr
Name of the tool, treated as the ID, has to be unique.
- tooltype
Class of the tool to be added. A subclass will be used instead if one was registered for the current canvas class.
- *args, **kwargs
Passed to the tool's constructor.
See also
matplotlib.backend_tools.ToolBaseThe base class for tools.
- property canvas#
Canvas managed by FigureManager.
- property figure#
Figure that holds the canvas.
- get_tool(name, warn=True)[source]#
Return the tool object with the given name.
For convenience, this passes tool objects through.
- get_tool_keymap(name)[source]#
Return the keymap associated with the specified tool.
- Parameters:
- namestr
Name of the Tool.
- Returns:
- list of str
List of keys associated with the tool.
- message_event(message, sender=None)[source]#
Emit a
ToolManagerMessageEvent.
- set_figure(figure, update_tools=True)[source]#
Bind the given figure to the tools.
- Parameters:
- figure
Figure - update_toolsbool, default: True
Force tools to update figure.
- figure