[Tutor] Closing a matplotlib window after show()

Wayne Watson sierra_mtnview at sbcglobal.net
Tue Feb 9 18:04:42 CET 2010


Well, you are correct. Finally, my latest post to the MPL list caught 
the eye of John Hunter. I think he wrote MPL. The way out is interactive 
use. One problem I've  had  with  Python packages they "seem" to based 
on some other product, which one is supposed to know. I sight Tkinter 
and now MPL. I last used MatLab five years ago, and wrote some simple 
programs in it, so at least I have a very modest idea of how it works. I 
may have to use it to grsp the interactive mode.

This problem has been a difficult one get a grip on. I've had socket 
error problems, difficulty getting Matlab back up on my machine, a 
possible install problem,  and a host of ambiguities about this use. The 
end is near.

On 2/8/2010 9:53 PM, Wayne Watson wrote:
> Hi, I'm not so sure that's true. I have a large 900 line program where 
> some original plot code just continues beyond plot() and show(), after 
> the user closes the plot window. New code that I put in gets knotted 
> up, as far as I can tell. In both cases, I've put print statements 
> after show(), but nothing appears in the shell or, if run  by clicking 
> the program file, in the DOS-like window that appears.
>
> Further, I posted this elsewhere, and someone claims to have tried a 
> few simple examples with show() at the ended,and they did not get tied 
> up in knots when the user closed the window. I'm going to assume he 
> used IDLE, or a  straight execute of the file.
>
> On 2/8/2010 2:23 PM, Eike Welk wrote:
>> Hello Wayne!
>>
>> On Monday February 8 2010 20:54:27 Wayne Watson wrote:
>>> The basic problem is the show(). One person checked out the examples I
>>> provided and found show() to operate fine. On my XP machine the program
>>> I'm modifying has plot code someone put in a year or two ago, and it 
>>> all
>>> works fine. My code produces the desired plot, but gets hung up on 
>>> show().
>> The behavior that you describe, is the normal behavior of Matplotlib: 
>> When you
>> call show(), the program gets stuck.
>>
>> Therefore the call to show is always the last statement in the example
>> programs. Show returns when the last plot window is closed, and in 
>> principle
>> the program could then continue.
>>
>> If you want to look at plots while the program is running, you must use
>> Ipython. This is a modified Python interpreter, that contains special 
>> code to
>> change the way how Matplotlib works.
>>
>> http://ipython.scipy.org/moin/
>>
>>
>> Eike.
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>>
>

-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW


More information about the Tutor mailing list