windows immediately close after show()

When I run some of the examples in pylab_examples, like
simple_plot.py, the call to show() yields a window that immediately
closes. This is with either the v1.0.x or master branches on OS X with
python 2.7 and the qt4 backend, with interactive=True in matplotlibrc.
When I change interactive to False, the window remains open until I
close it.

Is interactive=True not supported for scripts anymore?

No, everything is supposed to work with both values of interactive. The difference is supposed to be that show blocks only in non-interactive mode.

I see the same problem with qt4agg backend on linux. I don't think it was doing that back when I was working on show, so I suspect something changed in qt4agg backend; either that, or this is something I thought I tested but didn't. It still works under ipython from git.

Eric

···

On 04/04/2011 10:24 AM, Darren Dale wrote:

When I run some of the examples in pylab_examples, like
simple_plot.py, the call to show() yields a window that immediately
closes. This is with either the v1.0.x or master branches on OS X with
python 2.7 and the qt4 backend, with interactive=True in matplotlibrc.
When I change interactive to False, the window remains open until I
close it.

Is interactive=True not supported for scripts anymore?

After testing and thinking a bit, I think the answer is that it never was, unless you are in an environment like ipython. Certainly it hasn't been any time recently. A script run from the command line exits when it reaches the last line; if nothing blocks, then it will immediately close the window and exit. This is not backend-dependent or OS-dependent--it is just the way scripts work.

Eric

···

On 04/04/2011 10:24 AM, Darren Dale wrote:

When I run some of the examples in pylab_examples, like
simple_plot.py, the call to show() yields a window that immediately
closes. This is with either the v1.0.x or master branches on OS X with
python 2.7 and the qt4 backend, with interactive=True in matplotlibrc.
When I change interactive to False, the window remains open until I
close it.

Is interactive=True not supported for scripts anymore?

I thought I remembered there being two separate issues: whether or not
to block, and whether a plot is updated after each command or
rendering is deferred until show() is called. Things may have changed
when IPython pulled the threading monkeypatches, more likely my memory
is bad. Your explanation makes sense. Thanks.

Darren

···

On Mon, Apr 4, 2011 at 5:57 PM, Eric Firing <efiring@...229...> wrote:

On 04/04/2011 10:24 AM, Darren Dale wrote:

When I run some of the examples in pylab_examples, like
simple_plot.py, the call to show() yields a window that immediately
closes. This is with either the v1.0.x or master branches on OS X with
python 2.7 and the qt4 backend, with interactive=True in matplotlibrc.
When I change interactive to False, the window remains open until I
close it.

Is interactive=True not supported for scripts anymore?

After testing and thinking a bit, I think the answer is that it never
was, unless you are in an environment like ipython. Certainly it hasn't
been any time recently. A script run from the command line exits when
it reaches the last line; if nothing blocks, then it will immediately
close the window and exit. This is not backend-dependent or
OS-dependent--it is just the way scripts work.

Darren,

You are correct that interactive mode does have two effects, and I was only describing one--whether show blocks. The other effect of interactive mode is that pyplot commands, which include draw_if_interactive() calls, draw immediately when in interactive mode but draw only upon execution of show() when in non-interactive mode.

Eric

···

On 04/04/2011 12:35 PM, Darren Dale wrote:

On Mon, Apr 4, 2011 at 5:57 PM, Eric Firing<efiring@...229...> wrote:

On 04/04/2011 10:24 AM, Darren Dale wrote:

When I run some of the examples in pylab_examples, like
simple_plot.py, the call to show() yields a window that immediately
closes. This is with either the v1.0.x or master branches on OS X with
python 2.7 and the qt4 backend, with interactive=True in matplotlibrc.
When I change interactive to False, the window remains open until I
close it.

Is interactive=True not supported for scripts anymore?

After testing and thinking a bit, I think the answer is that it never
was, unless you are in an environment like ipython. Certainly it hasn't
been any time recently. A script run from the command line exits when
it reaches the last line; if nothing blocks, then it will immediately
close the window and exit. This is not backend-dependent or
OS-dependent--it is just the way scripts work.

I thought I remembered there being two separate issues: whether or not
to block, and whether a plot is updated after each command or
rendering is deferred until show() is called. Things may have changed
when IPython pulled the threading monkeypatches, more likely my memory
is bad. Your explanation makes sense. Thanks.

Darren