From: Hans F. <H.F...@so...> - 2005-01-11 19:29:56
|
Dear all, I tried to make matplotlib work with IDLE on Windows. I have settled for the Enthough Python Edition and the latest matplotlib (both executables can be found in www.soton.ac.uk/~fangohr/download/python). I have prepared the exercises on linux and am now trying to run them in windows. This is where I realised that matplotlib doesn't work well with IDLE. More particularly, it is known that the default backend TkAgg doesn't work with IDLE (see here http://matplotlib.sourceforge.net/backends.html#TkAgg) but it appears to work with "IDLE -n" (as it says on that web page). The problem I experience is this: -start idle -execute these commands: import pylab pylab.plot(range(10)) pylab.show() This produces a figure window which seems to work fine. At this point when closing the figure window, I can't get the IDLE prompt active again. (It seems that IDLE thinks the program and the figure process are still running, and is waiting for control to return.) This, in itself, is maybe not suprising. However, the idle -n switch doesn't seem to solve the problem for me (see below). The same problem is observed when I execute a program in the IDLE editor (by pressing F5). Maybe this is the problem: I have tried to tell IDLE to start with the "-n" by modifying the properties for the IDLE link in the start menu from C:\Python23\pythonw.exe "C:\Python23\Lib\idlelib\idle.pyw" to C:\Python23\pythonw.exe "C:\Python23\Lib\idlelib\idle.pyw" "-n" but this doesn't seem to solve the problem: I get exactly the same behaviour as described above. Am I doing the right thing? Can anyone give me some advice? Many thanks, Hans P.S. Funnily enough, there are two Windows machines with a very similar software setup, i.e. enthought python plus matplotlib, where the default TkAgg interface seems to work happily togethe with IDLE. Unfortunately, these are not the ones I am trying to get to work :-| ------------------------------------------------- Dr Hans Fangohr Computational Engineering & Design Research Group School of Engineering Sciences University of Southampton Southampton, SO17 1BJ United Kingdom Location: Building 25, Room 1027 phone : +44 (0) 23 8059 8345 fax : +44 (0) 23 8059 7082 email : fa...@so... ------------------------------------------------- |
From: Todd M. <jm...@st...> - 2005-01-11 19:44:34
|
Hi Hans, I just tried this out and found that setting "interactive" to "True" in C:\python23\share\matplotlib\.matplotlibrc obviated the need to use the show() command. The plot then comes up as soon as you issue the plot() command. Multiple plotting-closing cycles worked fine in the same Idle session. Regards, Todd On Tue, 2005-01-11 at 14:29, Hans Fangohr wrote: > Dear all, > > I tried to make matplotlib work with IDLE on Windows. I have settled for > the Enthough Python Edition and the latest matplotlib (both executables > can be found in www.soton.ac.uk/~fangohr/download/python). > > I have prepared the exercises on linux and am now trying to run them in > windows. This is where I realised that matplotlib doesn't work well with > IDLE. > > More particularly, it is known that the default backend TkAgg doesn't work > with IDLE (see here http://matplotlib.sourceforge.net/backends.html#TkAgg) > but it appears to work with "IDLE -n" (as it says on that web page). > > The problem I experience is this: > > -start idle > -execute these commands: > > import pylab > pylab.plot(range(10)) > pylab.show() > > This produces a figure window which seems to work fine. > > At this point when closing the figure window, I can't get the IDLE > prompt active again. (It seems that IDLE thinks the program and the figure > process are still running, and is waiting for control to return.) > > This, in itself, is maybe not suprising. However, the idle -n switch > doesn't seem to solve the problem for me (see below). > > The same problem is observed when I execute a program in the IDLE editor > (by pressing F5). > > Maybe this is the problem: > > I have tried to tell IDLE to start with the "-n" by modifying the properties for the > IDLE link in the start menu from > > C:\Python23\pythonw.exe "C:\Python23\Lib\idlelib\idle.pyw" > > to > > C:\Python23\pythonw.exe "C:\Python23\Lib\idlelib\idle.pyw" "-n" > > but this doesn't seem to solve the problem: I get exactly the same > behaviour as described above. Am I doing the right thing? > > Can anyone give me some advice? > > Many thanks, > > Hans > > > P.S. Funnily enough, there are two Windows machines with a very similar > software setup, i.e. enthought python plus matplotlib, where the default > TkAgg interface seems to work happily togethe with IDLE. Unfortunately, > these are not the ones I am trying to get to work :-| > > > > > > ------------------------------------------------- > Dr Hans Fangohr > > Computational Engineering & Design Research Group > School of Engineering Sciences > University of Southampton > Southampton, SO17 1BJ > United Kingdom > > Location: Building 25, Room 1027 > phone : +44 (0) 23 8059 8345 > fax : +44 (0) 23 8059 7082 > email : fa...@so... > ------------------------------------------------- > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- |
From: Hans F. <H.F...@so...> - 2005-01-11 21:17:16
|
Hi Todd, thanks for the quick response. > I just tried this out and found that setting "interactive" to "True" in > C:\python23\share\matplotlib\.matplotlibrc obviated the need to use the > show() command. The plot then comes up as soon as you issue the plot() > command. Hm. Done that. A figure window pops up immediately but is not being updated correctly: a part of the graph is visible, the other part of the figure (which was underneath another window initially) appears white. The titel of the figure says "Figure 1 (Not responding)". IDLE, however, responds happily ;-) T > Multiple plotting-closing cycles worked fine in the same Idle > session. Good -- so this works at your machine, not at mine. The strange thing is that I installed WinXP from scratch just a few days ago on that machine, so it should be a fairly 'clean' environment. I take it there is no more recent version of matplotlib for windows (and Python 2.3) than 0.70.1? Thanks, Hans > > Regards, > Todd > > On Tue, 2005-01-11 at 14:29, Hans Fangohr wrote: >> Dear all, >> >> I tried to make matplotlib work with IDLE on Windows. I have settled for >> the Enthough Python Edition and the latest matplotlib (both executables >> can be found in www.soton.ac.uk/~fangohr/download/python). >> >> I have prepared the exercises on linux and am now trying to run them in >> windows. This is where I realised that matplotlib doesn't work well with >> IDLE. >> >> More particularly, it is known that the default backend TkAgg doesn't work >> with IDLE (see here http://matplotlib.sourceforge.net/backends.html#TkAgg) >> but it appears to work with "IDLE -n" (as it says on that web page). >> >> The problem I experience is this: >> >> -start idle >> -execute these commands: >> >> import pylab >> pylab.plot(range(10)) >> pylab.show() >> >> This produces a figure window which seems to work fine. >> >> At this point when closing the figure window, I can't get the IDLE >> prompt active again. (It seems that IDLE thinks the program and the figure >> process are still running, and is waiting for control to return.) >> >> This, in itself, is maybe not suprising. However, the idle -n switch >> doesn't seem to solve the problem for me (see below). >> >> The same problem is observed when I execute a program in the IDLE editor >> (by pressing F5). >> >> Maybe this is the problem: >> >> I have tried to tell IDLE to start with the "-n" by modifying the properties for the >> IDLE link in the start menu from >> >> C:\Python23\pythonw.exe "C:\Python23\Lib\idlelib\idle.pyw" >> >> to >> >> C:\Python23\pythonw.exe "C:\Python23\Lib\idlelib\idle.pyw" "-n" >> >> but this doesn't seem to solve the problem: I get exactly the same >> behaviour as described above. Am I doing the right thing? >> >> Can anyone give me some advice? >> >> Many thanks, >> >> Hans >> >> >> P.S. Funnily enough, there are two Windows machines with a very similar >> software setup, i.e. enthought python plus matplotlib, where the default >> TkAgg interface seems to work happily togethe with IDLE. Unfortunately, >> these are not the ones I am trying to get to work :-| >> >> >> >> >> >> ------------------------------------------------- >> Dr Hans Fangohr >> >> Computational Engineering & Design Research Group >> School of Engineering Sciences >> University of Southampton >> Southampton, SO17 1BJ >> United Kingdom >> >> Location: Building 25, Room 1027 >> phone : +44 (0) 23 8059 8345 >> fax : +44 (0) 23 8059 7082 >> email : fa...@so... >> ------------------------------------------------- >> >> >> >> ------------------------------------------------------- >> The SF.Net email is sponsored by: Beat the post-holiday blues >> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. >> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------- Dr Hans Fangohr Computational Engineering & Design Research Group School of Engineering Sciences University of Southampton Southampton, SO17 1BJ United Kingdom Location: Building 25, Room 1027 phone : +44 (0) 23 8059 8345 fax : +44 (0) 23 8059 7082 email : fa...@so... ------------------------------------------------- |
From: Todd M. <jm...@st...> - 2005-01-11 21:34:10
|
On Tue, 2005-01-11 at 16:17, Hans Fangohr wrote: > Hi Todd, > > thanks for the quick response. > > > I just tried this out and found that setting "interactive" to "True" in > > C:\python23\share\matplotlib\.matplotlibrc obviated the need to use the > > show() command. The plot then comes up as soon as you issue the plot() > > command. > Hm. Done that. A figure window pops up immediately but is not being > updated correctly: a part of the graph is visible, the other part of the > figure (which was underneath another window initially) appears white. The > titel of the figure says "Figure 1 (Not responding)". > IDLE, however, responds happily ;-) T > > > Multiple plotting-closing cycles worked fine in the same Idle > > session. > Good -- so this works at your machine, not at mine. The strange thing is > that I installed WinXP from scratch just a few days ago on that machine, > so it should be a fairly 'clean' environment. > > I take it there is no more recent version of matplotlib for windows > (and Python 2.3) than 0.70.1? No. Just to be clear: I set interactive to True, and used "idle -n" from Python-2.3.4 and it worked fine for me on Windows 2000 Pro. Idle should be reporting "No Subprocess" when it starts up. Regards, Todd > Thanks, > > Hans > > > > > > Regards, > > Todd > > > > On Tue, 2005-01-11 at 14:29, Hans Fangohr wrote: > >> Dear all, > >> > >> I tried to make matplotlib work with IDLE on Windows. I have settled for > >> the Enthough Python Edition and the latest matplotlib (both executables > >> can be found in www.soton.ac.uk/~fangohr/download/python). > >> > >> I have prepared the exercises on linux and am now trying to run them in > >> windows. This is where I realised that matplotlib doesn't work well with > >> IDLE. > >> > >> More particularly, it is known that the default backend TkAgg doesn't work > >> with IDLE (see here http://matplotlib.sourceforge.net/backends.html#TkAgg) > >> but it appears to work with "IDLE -n" (as it says on that web page). > >> > >> The problem I experience is this: > >> > >> -start idle > >> -execute these commands: > >> > >> import pylab > >> pylab.plot(range(10)) > >> pylab.show() > >> > >> This produces a figure window which seems to work fine. > >> > >> At this point when closing the figure window, I can't get the IDLE > >> prompt active again. (It seems that IDLE thinks the program and the figure > >> process are still running, and is waiting for control to return.) > >> > >> This, in itself, is maybe not suprising. However, the idle -n switch > >> doesn't seem to solve the problem for me (see below). > >> > >> The same problem is observed when I execute a program in the IDLE editor > >> (by pressing F5). > >> > >> Maybe this is the problem: > >> > >> I have tried to tell IDLE to start with the "-n" by modifying the properties for the > >> IDLE link in the start menu from > >> > >> C:\Python23\pythonw.exe "C:\Python23\Lib\idlelib\idle.pyw" > >> > >> to > >> > >> C:\Python23\pythonw.exe "C:\Python23\Lib\idlelib\idle.pyw" "-n" > >> > >> but this doesn't seem to solve the problem: I get exactly the same > >> behaviour as described above. Am I doing the right thing? > >> > >> Can anyone give me some advice? > >> > >> Many thanks, > >> > >> Hans > >> > >> > >> P.S. Funnily enough, there are two Windows machines with a very similar > >> software setup, i.e. enthought python plus matplotlib, where the default > >> TkAgg interface seems to work happily togethe with IDLE. Unfortunately, > >> these are not the ones I am trying to get to work :-| > >> > >> > >> > >> > >> > >> ------------------------------------------------- > >> Dr Hans Fangohr > >> > >> Computational Engineering & Design Research Group > >> School of Engineering Sciences > >> University of Southampton > >> Southampton, SO17 1BJ > >> United Kingdom > >> > >> Location: Building 25, Room 1027 > >> phone : +44 (0) 23 8059 8345 > >> fax : +44 (0) 23 8059 7082 > >> email : fa...@so... > >> ------------------------------------------------- > >> > >> > >> > >> ------------------------------------------------------- > >> The SF.Net email is sponsored by: Beat the post-holiday blues > >> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > >> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > >> _______________________________________________ > >> Matplotlib-users mailing list > >> Mat...@li... > >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- > > > > > > > > ------------------------------------------------------- > > The SF.Net email is sponsored by: Beat the post-holiday blues > > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > ------------------------------------------------- > Dr Hans Fangohr > > Computational Engineering & Design Research Group > School of Engineering Sciences > University of Southampton > Southampton, SO17 1BJ > United Kingdom > > Location: Building 25, Room 1027 > phone : +44 (0) 23 8059 8345 > fax : +44 (0) 23 8059 7082 > email : fa...@so... > ------------------------------------------------- > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- |
From: John H. <jdh...@ac...> - 2005-01-11 21:26:44
|
>>>>> "Hans" == Hans Fangohr <H.F...@so...> writes: Hans> Hm. Done that. A figure window pops up immediately but is Hans> not being updated correctly: a part of the graph is visible, Hans> the other part of the figure (which was underneath another Hans> window initially) appears white. The titel of the figure Hans> says "Figure 1 (Not responding)". IDLE, however, responds Hans> happily ;-) T Todd, many moons ago you wrote me and said I had inadvertently screwed up something in tkagg show that broke the idle -n behavior. If I recall correctly, we never reverted, since I didn't understand exactly what to do. Perhaps you could revisit the current tkagg versus the old one to make sure it is right. Hans, does it make a difference if you uncomment #os.environ['PYTHONINSPECT'] = '1' in the show method of site-packages/matplotlib/backends/backend_tkagg.py? You should set 'interactive : True' as Todd suggested. Do not use show, as it is not designed for interactive use. I suggest carefully testing all 4 combinations: with and without the PYTHONINSPECTmline, and with and without -n. As you probably know, you'll need to restart idle after every change to the module source code, or at least reload the module if you know how to do that. Some bugs refuse to die. Let us know... Hans> I take it there is no more recent version of matplotlib for Hans> windows (and Python 2.3) than 0.70.1? That's the latest. Good luck! JDH |
From: Hans F. <H.F...@so...> - 2005-01-11 21:44:37
|
John, >>>>>> "Hans" == Hans Fangohr <H.F...@so...> writes: > > Hans> Hm. Done that. A figure window pops up immediately but is > Hans> not being updated correctly: a part of the graph is visible, > Hans> the other part of the figure (which was underneath another > Hans> window initially) appears white. The titel of the figure > Hans> says "Figure 1 (Not responding)". IDLE, however, responds > Hans> happily ;-) T > > Todd, many moons ago you wrote me and said I had inadvertently screwed > up something in tkagg show that broke the idle -n behavior. If I > recall correctly, we never reverted, since I didn't understand exactly > what to do. Perhaps you could revisit the current tkagg versus the > old one to make sure it is right. > > Hans, does it make a difference if you uncomment > > #os.environ['PYTHONINSPECT'] = '1' > > in the show method of > site-packages/matplotlib/backends/backend_tkagg.py? You should set > 'interactive : True' as Todd suggested. Do not use show, as it is not > designed for interactive use. I suggest carefully testing all 4 > combinations: with and without the PYTHONINSPECTmline, and with and > without -n. Setting 'interactive=True' in .matplotlibrc IDLE #os.environ['PYTHONINSPECT'] = '1' -> fail IDLE -n #os.environ['PYTHONINSPECT'] = '1' -> fail IDLE os.environ['PYTHONINSPECT'] = '1' -> fail IDLE -n os.environ['PYTHONINSPECT'] = '1' -> success So that's good. However, notice that also setting 'interactive=False' IDLE os.environ['PYTHONINSPECT'] = '1' seems to work! (Which is what I wanted initially and what didn't work.) So from my naive perspective the line "environ['PYTHONINSPECT'] = '1' " should not be commented. Thanks for you help -- hope this is useful, Hans |
From: Hans F. <H.F...@so...> - 2005-01-25 20:09:40
|
Hi John, I am coming back to our earlier discussion ... >>>>>>> "Hans" == Hans Fangohr <H.F...@so...> writes: >> >>> Hm. Done that. A figure window pops up immediately but is >>> not being updated correctly: a part of the graph is visible, >>> the other part of the figure (which was underneath another >>> window initially) appears white. The titel of the figure >>> says "Figure 1 (Not responding)". IDLE, however, responds >>> happily ;-) T >> >> Todd, many moons ago you wrote me and said I had inadvertently screwed >> up something in tkagg show that broke the idle -n behavior. If I >> recall correctly, we never reverted, since I didn't understand exactly >> what to do. Perhaps you could revisit the current tkagg versus the >> old one to make sure it is right. >> >> Hans, does it make a difference if you uncomment >> >> #os.environ['PYTHONINSPECT'] = '1' >> >> in the show method of >> site-packages/matplotlib/backends/backend_tkagg.py? You should set >> 'interactive : True' as Todd suggested. Do not use show, as it is not >> designed for interactive use. I suggest carefully testing all 4 >> combinations: with and without the PYTHONINSPECTmline, and with and >> without -n. > > Setting 'interactive=True' in .matplotlibrc > > IDLE #os.environ['PYTHONINSPECT'] = '1' -> fail > IDLE -n #os.environ['PYTHONINSPECT'] = '1' -> fail > IDLE os.environ['PYTHONINSPECT'] = '1' -> fail > IDLE -n os.environ['PYTHONINSPECT'] = '1' -> success > > So that's good. This doesn't work in non-interactive mode. What I observe is this: - start Idle with -n (the "==== No Subprocess ====" message appears). - at prompt issue commands: >>>import pylab >>>pylab.plot(range(10)) >>>pylab.show() - figure windows shows up - python reports this error message: >>> pylab.show() Exception in Tkinter callback Traceback (most recent call last): File "C:\Python23\lib\lib-tk\Tkinter.py", line 1345, in __call__ return self.func(*args) File "C:\Python23\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 215, in key_release FigureCanvasBase.key_release_event(self, key) File "C:\Python23\Lib\site-packages\matplotlib\backend_bases.py", line 677, in key_release_event event = KeyEvent('key_release_event', self, key, self._lastx, self._lasty) File "C:\Python23\Lib\site-packages\matplotlib\backend_bases.py", line 640, in __init__ LocationEvent.__init__(self, name, canvas, x, y) File "C:\Python23\Lib\site-packages\matplotlib\backend_bases.py", line 566, in __init__ if a.in_axes(self.x, self.y): File "C:\Python23\Lib\site-packages\matplotlib\axes.py", line 1544, in in_axes return self.bbox.contains(xwin, ywin) TypeError: float() argument must be a string or a number The figure windows is interacting (despite the error message). Once I close the figure window, I can't get back to the Python prompt; i.e. the shell doesn't respond any more. Do we expect matplotlib (0.70.1) to work in non-interactive mode with "IDLE -n"? Thanks, Hans |
From: John H. <jdh...@ac...> - 2005-01-25 20:14:47
|
>>>>> "Hans" == Hans Fangohr <H.F...@so...> writes: Hans> The figure windows is interacting (despite the error Hans> message). Once I close the figure window, I can't get back Hans> to the Python prompt; i.e. the shell doesn't respond any Hans> more. Hans> Do we expect matplotlib (0.70.1) to work in non-interactive Hans> mode with "IDLE -n"? This is an unrelated bug fixed in 0.71. Thanks for the report! JDH |
From: Hans F. <H.F...@so...> - 2005-01-25 21:17:57
|
Hi John, > Hans> The figure windows is interacting (despite the error > Hans> message). Once I close the figure window, I can't get back > Hans> to the Python prompt; i.e. the shell doesn't respond any > Hans> more. > > Hans> Do we expect matplotlib (0.70.1) to work in non-interactive > Hans> mode with "IDLE -n"? > > This is an unrelated bug fixed in 0.71. > > Thanks for the report! Hm. Have upgraded to 0.71. Now I don't get the error message anymore, however, once I close the figure window, the IDLE (-n) prompt doesn't respond anymore. (Same scenario as described in last email.) Ideas? > JDH > > > > > > > > ------------------------------------------------- Dr Hans Fangohr Computational Engineering & Design Research Group School of Engineering Sciences University of Southampton Southampton, SO17 1BJ United Kingdom Location: Building 25, Room 1027 phone : +44 (0) 23 8059 8345 fax : +44 (0) 23 8059 7082 email : fa...@so... ------------------------------------------------- |
From: John H. <jdh...@ac...> - 2005-01-25 21:20:01
|
>>>>> "Hans" == Hans Fangohr <H.F...@so...> writes: Hans> Hm. Have upgraded to 0.71. Now I don't get the error message Hans> anymore, however, once I close the figure window, the IDLE Hans> (-n) prompt doesn't respond anymore. (Same scenario as Hans> described in last email.) Hans> Ideas? Well, if you are using matplotlib interactively from within IDLE< then interactive : True should be set in your rc file, no? JDH |
From: Hans F. <H.F...@so...> - 2005-01-26 14:17:45
|
John, >>>>>> "Hans" == Hans Fangohr <H.F...@so...> writes: > > Hans> Hm. Have upgraded to 0.71. Now I don't get the error message > Hans> anymore, however, once I close the figure window, the IDLE > Hans> (-n) prompt doesn't respond anymore. (Same scenario as > Hans> described in last email.) > > Hans> Ideas? > Well, if you are using matplotlib interactively from within IDLE< then > interactive : True should be set in your rc file, no? I didn't make myself very clear, or I have misunderstood the meaning of "interactive". I presumed that 'interactive' means: I issue the plot command and the figure pops up immediatly, etc. Not interactive (in my understanding) means that I issue all the matplotlib commands I'd like to use and at the end I can use show() to display the picture. I presumed that when I close the figure windows (by clicking on the right symbol on the window), I could carry on using the IDLE session (in this example). Here is the bit that I didn't expect and assumed would be some kind of bug: I need to kill IDLE (when clicking on the [X] symbol in the upper right hand corner of the IDLE -n window in MS XP, I get the message :" The program is still running! Do you want to kill it?"). In summary, I can't carry on using the session once I have used the show() command. Thanks, Hans |
From: John H. <jdh...@ac...> - 2005-01-26 15:15:49
|
>>>>> "Hans" == Hans Fangohr <H.F...@so...> writes: Hans> I didn't make myself very clear, or I have misunderstood the Hans> meaning of "interactive". I presumed that 'interactive' Hans> means: I issue the plot command and the figure pops up Hans> immediatly, etc. Hans> Not interactive (in my understanding) means that I issue all Hans> the matplotlib commands I'd like to use and at the end I can Hans> use show() to display the picture. This partially but not completely correct, but it is admittedly confusing. Make sure you have read http://matplotlib.sourceforge.net/interactive.html and http://matplotlib.sourceforge.net/faq.html#SHOW . As emphasized in the FAQ IMPORTANT: show should called at most once per script and it should be the last line of your script. At that point, the GUI takes control of the interpreter. If you want to force a figure draw, use draw instead. If you are issuing plot commands from idle, you need interactive : True, you should not use show, and if you want finer control of when the plot pops up and it drawn, use the commands ion, ioff and draw, as explained on the interactive.html link. Hope this helps -- if you still encounter problems please let us know because it is always possible there is a bug .... JDH |
From: Todd M. <jm...@st...> - 2005-01-26 15:30:36
|
On Wed, 2005-01-26 at 10:09, John Hunter wrote: > >>>>> "Hans" == Hans Fangohr <H.F...@so...> writes: > > Hans> I didn't make myself very clear, or I have misunderstood the > Hans> meaning of "interactive". I presumed that 'interactive' > Hans> means: I issue the plot command and the figure pops up > Hans> immediatly, etc. > > Hans> Not interactive (in my understanding) means that I issue all > Hans> the matplotlib commands I'd like to use and at the end I can > Hans> use show() to display the picture. > > This partially but not completely correct, but it is admittedly > confusing. Make sure you have read > http://matplotlib.sourceforge.net/interactive.html and > http://matplotlib.sourceforge.net/faq.html#SHOW . As emphasized in > the FAQ > > IMPORTANT: show should called at most once per script and it should > be the last line of your script. At that point, the GUI takes > control of the interpreter. If you want to force a figure draw, use > draw instead. > > If you are issuing plot commands from idle, you need interactive : > True, you should not use show, and if you want finer control of when > the plot pops up and it drawn, use the commands ion, ioff and draw, as > explained on the interactive.html link. > > Hope this helps -- if you still encounter problems please let us know > because it is always possible there is a bug .... I'm really busy this morning (like what else is new for any of us), but I can confirm that there is a bug in 0.71. The root cause is that an "extra" mainloop is now run by matplotlib in "Idle -n" which already has a mainloop of its own. I think the key to solving this class of problem is to detect the presence of "freebe" mainloops to avoid running two mainloops while ensuring that we run at least one. To do this, I'm hoping matplotlib can ask Tkinter if a mainloop is running or not. The only alternative that occurs to me is to detect the presence of particular shells and maintain knowledge about the "freebe mainloop" status of each. This morning, I tried to detect IDLE using "'idlelib.__main__' in sys.modules.keys()" and was able to fix the current bug by suppressing the mainloop and assuming that "Idle -n" is running and not "Idle". It would be much better to detect the mainloop directly though. Regards, Todd |