2010/4/20 Ryan May <rma...@gmail.com>

> On Tue, Apr 20, 2010 at 4:44 PM, Antony Lee <antony....@ensmp.fr> wrote:
> > That would be a solution, indeed.  However, is there really no way of
> coming
> > back to a pre-plt.show() state once all windows are closed?  What kind of
> > irreversible things does plt.show() do?
>
> It starts the GUI toolkit event loop, which starts to make things
> messy if you try to call show() again. It often works, but calling
> show() more than once is most-definitely not supported.
>
OK, I can understand this...

>
> Now, depending on what exactly you're trying to do, you can set
> everything up to work off of events from the GUI so that once you call
> show(), the user can click on
> various things and trigger actions. Have you looked at the examples
> in: examples/event_handling?
>
Well, the problem isn't there (I believe). The workflow I'd like to
implement is that, for example the user does some data processing (in
ipython), plots some data (I need a show() here), closes the plot window,
does some other data processing (in ipython), plots other data (no show()
needed here, as we're still in show() mode) *and selects some data by
clicking on the plot* (I use fig.canvas.mpl_connect, as in the
examples/event_handling). The last part works if it's the first time I'm
show()ing a plot, but not the second time, and, looking at the tracebacks,
it seems that this is because the first time, the program waits for the
window to be closed to continue (so it can access the data it retrieves from
the button_press_events), but the second time, it doesn't -- so of course it
tries to access undefined variables.
So basically, what I want (if I am not mistaken about the origin of the
problem) is to have blocking calls again for my second plot. Buf ioff()
isn't sufficient for this, either (which is not a surprise as show() does
more than ion()).

Probably at some point I'll have to rewrite the whole lot for a specific
backend, but I'd like to stick to a pure matplotlib solution as for now.

Thanks in advance,
Antony

>
> Ryan
>
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
>
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to