matplotlib.backend_managers
¶ToolManager
matplotlib.backend_managers.
ToolEvent
(name, sender, tool, data=None)¶Bases: object
Event for tool manipulation (add/remove)
matplotlib.backend_managers.
ToolManager
(figure=None)¶Bases: object
Helper class that groups all the user interactions for a FigureManager
Attributes
manager: FigureManager |
|
keypresslock: widgets.LockDraw |
LockDraw object to know if the canvas key_press_event is locked |
messagelock: widgets.LockDraw |
LockDraw object to know if the message is available to write |
active_toggle
¶Currently toggled tools
add_tool
(name, tool, *args, **kwargs)¶Add tool to ToolManager
If successful adds a new event tool_trigger_name
where name is
the name of the tool, this event is fired everytime
the tool is triggered.
Parameters: | name : str
tool : class_like, i.e. str or type
|
---|
See also
matplotlib.backend_tools.ToolBase
Notes
args and kwargs get passed directly to the tools constructor.
canvas
¶Canvas managed by FigureManager
figure
¶Figure that holds the canvas
get_tool
(name, warn=True)¶Return the tool object, also accepts the actual tool for convenience
Parameters: | name : str, ToolBase
warn : bool, optional
|
---|
get_tool_keymap
(name)¶Get the keymap associated with the specified tool
Parameters: | name : string
|
---|---|
Returns: | list : list of keys associated with the Tool |
message_event
(message, sender=None)¶Emit a ToolManagerMessageEvent
remove_tool
(name)¶Remove tool from ToolManager
Parameters: | name : string
|
---|
set_figure
(figure, update_tools=True)¶Sets the figure to interact with the tools
Parameters: | figure: `Figure` update_tools: bool
|
---|
toolmanager_connect
(s, func)¶Connect event with string s to func.
Parameters: | s : String
func : function
|
---|
toolmanager_disconnect
(cid)¶Disconnect callback id cid
Example usage:
cid = toolmanager.toolmanager_connect('tool_trigger_zoom',
on_press)
#...later
toolmanager.toolmanager_disconnect(cid)
tools
¶Return the tools controlled by ToolManager
trigger_tool
(name, sender=None, canvasevent=None, data=None)¶Trigger a tool and emit the tool_trigger_[name] event
Parameters: | name : string
sender: object
canvasevent : Event
data : Object
|
---|
update_keymap
(name, *keys)¶Set the keymap to associate with the specified tool
Parameters: | name : string
keys : keys to associate with the Tool |
---|
matplotlib.backend_managers.
ToolManagerMessageEvent
(name, sender, message)¶Bases: object
Event carrying messages from toolmanager
Messages usually get displayed to the user by the toolbar
matplotlib.backend_managers.
ToolTriggerEvent
(name, sender, tool, canvasevent=None, data=None)¶Bases: matplotlib.backend_managers.ToolEvent
Event to inform that a tool has been triggered