title: Multiple wxpython tabs handling matplotlib events badly
body: <p>I worked really hard understanding this, and it feels so darn close!
  I have a loop in which I create some wxpanels and attach them to notebook tabs.  Each tab contains a plot.  Originally the event call on the plot didn't pass the correct plot panel, so the event handling function reported the position for the wrong plot.  I thought I would sort that out with a dict:</p>
  
  <pre><code>    self.plotdict ["plot" + str(plotcounter)] = wx.Panel(self, id=wx.ID_ANY)
  </code></pre>
  
  <p>then I was able to change my function so it passed the dict key rather than the plot, which I feel better with anyway.</p>
  
  <pre><code>    self.plotdict ["plot" + str(plotcounter)].canvas.mpl_connect('motion_notify_event', lambda event: self.cbUpdateCursor(event, ("plot" + str(plotcounter))))
  </code></pre>
  
  <p>however, even when this loop has run many times, and I have many plots in tabs, this line in the loop always sends the same key to the function self.cbUpdateCursor, as if it is only using the function call for the last tab/plot created.</p>
  
  <pre><code>        def cbUpdateCursor(self, event, plot):
      if event.inaxes:
          text = 'x = %5.4f, y = %5.4f' % (event.xdata, event.ydata)
          print text
          print plot
          print self.plotdict[plot]
          print id(self.plotdict [plot])
          self.plotdict [plot].cursor_pos.SetLabel(text)
  </code></pre>
  
  <p>this means that the print from the function (which is only there for testing), shows the same plot referece regardless of which tab and therefore which plot the mouse event occurd on.</p>
  
  <pre><code>  Print results for mouse over plot1
      x = -127.8006, y = 135.9350
      plot3
      &lt;wx._windows.Panel; proxy of &lt;Swig Object of type 'wxPanel *' at 0x2f63758&gt; &gt;
      52125616
    Print results for mouse over plot2
      x = -185.0618, y = 137.9096
      plot3
      &lt;wx._windows.Panel; proxy of &lt;Swig Object of type 'wxPanel *' at 0x2f63758&gt; &gt;
      52125616
  </code></pre>
  
  <p>why is my mouse event on my canvas calling the function associated with plot 3 regardless of which plot my mouse is on? (plot 3 in this case was the last one created).</p>