Hi, recently I have the same problem with Matplotlib. I wrote a wxpython program which can plot a graph when click a button. When I click the button first time, I got the plot correct, but when I closed the figure, and clicked the button again, the code crashed. I have to reopen the program, and the same problem happened. The solution is that put "import matplotlib.pyplot as plt" before you plot anything. Then everything works fine. I don't know why. It seems that when you close the figure, the imported module or function stop working. It has to be imported every time.
On Tue, Feb 9, 2010 at 5:00 AM, <tutor-requ...@python.org> wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body 'help' to > tutor-requ...@python.org > > You can reach the person managing the list at > tutor-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tutor digest..." > > > Today's Topics: > > 1. python (ailx ailx) > 2. Re: python (Luke Paireepinart) > 3. Re: Closing a matplotlib window after show() (Wayne Watson) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 9 Feb 2010 10:54:06 +0800 > From: ailx ailx <ailxr...@gmail.com> > To: tutor@python.org > Subject: [Tutor] python > Message-ID: > <5fc821071002081854k2fa92309ned9389b9f3d91...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > python > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/tutor/attachments/20100209/a46c4683/attachment-0001.htm > > > > ------------------------------ > > Message: 2 > Date: Mon, 8 Feb 2010 21:09:59 -0600 > From: Luke Paireepinart <rabidpoob...@gmail.com> > To: ailx ailx <ailxr...@gmail.com> > Cc: tutor@python.org > Subject: Re: [Tutor] python > Message-ID: > <dfeb4471002081909t496fc217w355010e085b66...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > quite. > > On Mon, Feb 8, 2010 at 8:54 PM, ailx ailx <ailxr...@gmail.com> wrote: > > > python > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > To unsubscribe or change subscription options: > > http://mail.python.org/mailman/listinfo/tutor > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/tutor/attachments/20100208/b19399fe/attachment-0001.htm > > > > ------------------------------ > > Message: 3 > Date: Mon, 08 Feb 2010 21:53:39 -0800 > From: Wayne Watson <sierra_mtnv...@sbcglobal.net> > To: Eike Welk <eike.w...@gmx.net> > Cc: tutor@python.org > Subject: Re: [Tutor] Closing a matplotlib window after show() > Message-ID: <4b70f863.1070...@sbcglobal.net> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > 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@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 > > > ------------------------------ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > > End of Tutor Digest, Vol 72, Issue 34 > ************************************* >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor