Hi,

I'm writing a TkInter Python app with several threads. Neither are parts of python I'm super-familiar with, but, mostly things have been going well. Anyway, I have a button that I want to launch a plot using matplotlib (or pylab), and I've tried several different ways of coding it. The current code is simply:

Code:
import matplotlib.pyplot as plt
...

plt.plot(self.plotBuffer)
plt.show()
I've had no trouble getting the plot to launch. The problem is this, I may launch a plot and then close it. Then when I launch a second plot later, when I try to close it, the toolbar collapses, and the plotter doesn't close. I then get the errors:
Code:
Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/matplotlib/backends/backend_wx.py", line 1243, in _onMotion
    FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=evt)
  File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", line 1139, in motion_notify_event
    self.callbacks.process(s, event)
  File "/Library/Python/2.5/site-packages/matplotlib/cbook.py", line 154, in process
    func(*args, **kwargs)
  File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", line 1681, in mouse_move
    if self._lastCursor != cursors.POINTER:
  File "/BinaryCache/wxWidgets/wxWidgets-11~88/Root/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-unicode/wx/_core.py", line 14041, in __getattr__
wx._core.PyDeadObjectError: The C++ part of the NavigationToolbar2WxAgg object has been deleted, attribute access no longer allowed.
Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/matplotlib/backends/backend_wx.py", line 1249, in _onLeave
    FigureCanvasBase.motion_notify_event(self, -1, -1, guiEvent=evt)
  File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", line 1139, in motion_notify_event
    self.callbacks.process(s, event)
  File "/Library/Python/2.5/site-packages/matplotlib/cbook.py", line 154, in process
    func(*args, **kwargs)
  File "/Library/Python/2.5/site-packages/matplotlib/backend_bases.py", line 1681, in mouse_move
    if self._lastCursor != cursors.POINTER:
  File "/BinaryCache/wxWidgets/wxWidgets-11~88/Root/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/wx-2.8-mac-unicode/wx/_core.py", line 14041, in __getattr__
wx._core.PyDeadObjectError: The C++ part of the NavigationToolbar2WxAgg object has been deleted, attribute access no longer allowed.
Unsure if it's worth mentioning, but at this point, the plot remains open until I terminate python, however I can click the button and open and close secondary plots at will at this point.

Any ideas would be very much appreciated. Thanks.