class_docstr: Extend the default wx toolbar with your own event handlers.
class_docstr_tok: ["Extend","the","default","wx","toolbar","with","your","own","event","handlers","."]
code: def _on_custom(self, event):
      # add some text to the Axes in a random location in axes coords with a
      # random color
      ax = self.canvas.figure.axes[0]
      x, y = np.random.rand(2)  # generate a random location
      rgb = np.random.rand(3)  # generate a random color
      ax.text(x, y, "You clicked me", transform=ax.transAxes, color=rgb)
      self.canvas.draw()
      event.Skip()
  
file_path: matplotlib/galleries/examples/user_interfaces/embedding_in_wx4_sgskip.py
imports: import wx
  import numpy
  from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
  from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
  from matplotlib.figure import Figure
label_desc: Use image node_id 2 for calling the MyNavigationToolbar obj's underlying member method code with example usage: obj._on_custom(event) without return types