On 04/04/2011 12:35 PM, Darren Dale wrote:
> On Mon, Apr 4, 2011 at 5:57 PM, Eric Firing<efiring@...> 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
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
|