Hi, I'm new to matplotlib, trying to migrate from Matlab, so please excuse my rookie ignorance and Matlab thinking.
My question is: why does a GUI figure crash upon repeated calls in IPython?
Here is a detailed description:
I'm using the Enthought Python Distribution (EPD_Py25) and I enter IPython with the command: "ipython". I then run the script below using: %run myScript.py. Everything works fine: when I press 'Enter' while in the GUI the figure closes and I can retrieve the data from obj.x. However, when I run the script again using %run myScript.py a figure is generated but nothing happens; I am forced to reset everything using pyplot.close('all'), but cannot regain the GUI functionality without exiting IPython.
This problem does not occur if I use EPD's PyLab (i.e. "ipython -pylab"). Does anyone know why?
Here is the script:
from numpy.random import rand
from matplotlib import pyplot
self.fig = pyplot.gcf()
self.x = x
self.cidkeypress = self.fig.canvas.mpl_connect('key_press_event', self.keypress)
if event.key == 'enter':
self.x = rand(self.x.size)
obj = myGUI(rand(10))