class_docstr: Helper class that groups all the user interactions for a Figure
  
  Attributes
  ----------
  figure: `Figure`
  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
class_docstr_tok: ["Helper","class","that","groups","all","the","user","interactions","for","a","Figure","Attributes","--","--","--","--","--","figure",":","`","Figure","`","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"]
docstr: 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
      Name of the tool, treated as the ID, has to be unique
  tool : class_like, i.e. str or type
      Reference to find the class of the Tool to added.
  
  Notes
  -----
  args and kwargs get passed directly to the tools constructor.
  
  See Also
  --------
  matplotlib.backend_tools.ToolBase : The base class for tools.
docstr_tok: ["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","Name","of","the","tool",",","treated","as","the","ID",",","has","to","be","unique","tool",":","class_like",",","i.e",".","str","or","type","Reference","to","find","the","class","of","the","Tool","to","added",".","Notes","--","--","-","args","and","kwargs","get","passed","directly","to","the","tools","constructor",".","See","Also","--","--","--","--","matplotlib.backend_tools.ToolBase",":","The","base","class","for","tools","."]
code: def add_tool(self, 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
          Name of the tool, treated as the ID, has to be unique
      tool : class_like, i.e. str or type
          Reference to find the class of the Tool to added.
  
      Notes
      -----
      args and kwargs get passed directly to the tools constructor.
  
      See Also
      --------
      matplotlib.backend_tools.ToolBase : The base class for tools.
      """
  
      tool_cls = self._get_cls_to_instantiate(tool)
      if not tool_cls:
          raise ValueError(
              "Impossible to find class for %s" % str(tool)
          )
  
      if name in self._tools:
          warnings.warn(
              'A "Tool class" with the same name already exists, '
              "not added"
          )
          return self._tools[name]
  
      tool_obj = tool_cls(self, name, *args, **kwargs)
      self._tools[name] = tool_obj
  
      if tool_cls.default_keymap is not None:
          self.update_keymap(name, tool_cls.default_keymap)
  
      # For toggle tools init the radio_group in self._toggled
      if isinstance(tool_obj, tools.ToolToggleBase):
          # None group is not mutually exclusive, a set is used to keep track
          # of all toggled tools in this group
          if tool_obj.radio_group is None:
              self._toggled.setdefault(None, set())
          else:
              self._toggled.setdefault(tool_obj.radio_group, None)
  
          # If initially toggled
          if tool_obj.toggled:
              self._handle_toggle(tool_obj, None, None, None)
      tool_obj.set_figure(self.figure)
  
      self._tool_added_event(tool_obj)
      return tool_obj
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import six
  import warnings
  import matplotlib.cbook
  import matplotlib.widgets
  from matplotlib.rcsetup import validate_stringlist
  import matplotlib.backend_tools
label_desc: Use image node_id 14 for calling the ToolManager obj's underlying member method code with example usage: obj.add_tool(name, tool) and returns: tool_obj, self