On Thu, Apr 24, 2008 at 08:59:32AM -0500, John Hunter wrote: > On Wed, Apr 23, 2008 at 1:49 PM, Glen W. Mabey <[EMAIL PROTECTED]> wrote: > > Hello, > > > > I'm using today's svn source and I'm surprised that the following loop > > does not get redrawn 10 times. > > > > for it in range( 10 ): > > plot( arange( it ) ) > > draw() > > raw_input(); > > > > That is, within a 'ipython -pylab' session. Is this really a question > > for the ipython folks? Or am I missing something here? > > Can you explain what is happening in your code? First off, in pylab > mode this should be drawn 20 times, because in interactive mode plot > forces a draw and draw does too, so you should get 20 draws. > Secondly, ipython in pylab mode for some backends (Qt, GTK and WX) run > the GUI mainloop in a thread and I am not sure what will happen with > the "raw_input" which you expect to be blocking (it is not supported).
Hi John, I guess it was for that reason (that the GUI mainloop runs in a different thread) that I was expecting the draw to succeed. > Folks have had various successes with getting blocking input for > matplotlib in interactive sessions, but Gael has made the most > progress. See the ginput function in svn > > -- "ginput'' in pylab or matplotlib.pyplot > > -- matplotlib.figure.Figure.ginput in the API > > from pylab import arange, plot, sin, ginput, show > t = arange(10) > plot(t, sin(t)) > print "Please click" > x = ginput(3, verbose=True) > show() After looking at that code, I don't immediately see how a similar approach could be used for retrieving keyboard input from the user while still allowing MPL drawing in the same loop. But thank you for pointing out that example. Best Regards, Glen Mabey ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users