fix for wx backend with pylab interface

When I was trying to use the pylab interface from a wxPython application, I noticed that the application did not close completely after exiting. A python process continued to run in the background even though no windows were open.

The show command was starting a MainLoop() for the wx application even if the MainLoop() was already running. When the application closed, this extra MainLoop() kept running in the background. I was able to fix this problem in my own install of matplotlib by only starting the wx MainLoop if the MainLoop was not already running.

I’ve submitted a patch to correct this problem (Tracker #1747313). I hope it’s in the correct format.

Tim,

I didn't realize you could call MainLoop() from within the main loop. I guess you do learn something new every day. :wink:

Anyway, Your patch has been applied in svn rev 3459. If you're embedding matplotlib plots in a wxPython application you really ought to avoid pylab. The matplotlib cookbook has some information about the other approaches:

  http://www.scipy.org/Cookbook/Matplotlib/EmbeddingInWx

Ken