title: Choosing a point in matplotlib embedded in wxPython
body: <p>I'm trying to select and display data about a point in matplotlib embedded in wxPython.</p>
  
  <p>I've written a minimal example which plots random data.  The code is below.</p>
  
  <pre><code>import numpy as np
  import wx
  
  
  from matplotlib.figure import Figure
  from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
  
  class PlotGUI(wx.Frame):
      """Class to display basic GUI elements."""
      def __init__(self, parent):
          wx.Frame.__init__(self, parent)
  
          panel = wx.Panel(self)
          self.panel = panel
  
          vert_sizer = wx.BoxSizer(wx.VERTICAL)
          self.vert_sizer = vert_sizer
  
          panel.figure = Figure()
          panel.canvas = FigureCanvas(panel, -1, panel.figure)
          self.panel.canvas = panel.canvas
  
          panel.axes = panel.figure.add_subplot(111)
          self.panel.axes = panel.axes
  
          vert_sizer.Add(panel.canvas, 1, wx.LEFT | wx.TOP | wx.EXPAND)
          panel.SetSizer(vert_sizer)
          panel.Fit()
  
          self.plot_data()
  
          self.panel.canvas.mpl_connect('pick_event', self.display_data)
  
      def display_data(self, event):
          wx.MessageBox('x :'+str(event.mouseevent.xdata) + 'y: ' + str(event.mouseevent.ydata), 'Info',wx.OK | wx.ICON_INFORMATION)
  
      def plot_data(self):
          x = np.arange(10)
          y = np.random.randn(10)
          self.panel.axes.plot(x,y, 'o', picker = 5)
  
  def main():
      app = wx.App()
      GUI = PlotGUI(None)
      GUI.Show()
      app.MainLoop()
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>The first time I click a point, the data is correctly displayed.  However, the next time I click a point, I receive an error.  I tried searching for this error, but I wasn't able to find any relevant threads.  Thanks in advance for the help.</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/pythontology/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_wx.py", line 1137, in _onLeftButtonDown
      self.CaptureMouse()
    File "/home/pythontology/anaconda/lib/python2.7/site-packages/wx-3.0-gtk2/wx/_core.py", line 10641, in CaptureMouse
      return _core_.Window_CaptureMouse(*args, **kwargs)
  wx._core.PyAssertionError: C++ assertion "!wxMouseCapture::IsInCaptureStack(this)" failed at ./src/common/wincmn.cpp(3271) in CaptureMouse(): Recapturing the mouse in the same window?
  </code></pre>