appologies - sys.stdin.read(1) blocks until you give it a new line
(<Enter>) that' s probably what you were having problems with.
Paul Ivanov, on 2009-08-23 01:14, wrote:
> Try something like this:
>
>
> from os import sys
> from matplotlib import *
> from numpy.random import rand
>
> fig= pyplot.figure(figsize=(8,8), dpi=120)
> pyplot.show()
> while True:
> z= rand(20,20)
> pyplot.imshow(z)
> pyplot.draw()
>
> chr= sys.stdin.read(1)
> if chr=='q':
> break
>
> pyplot.close('all')
>
>
> cheers,
> Paul
>
> Dr. Phillip M. Feldman, on 2009-08-22 23:19, wrote:
> >
> > The following trivial program is supposed to generate one plot per key press
> > until the user presses 'q'. Instead, nothing is displayed until the user
> > presses 'q'. Any suggestions will be appreciated.
> >
> > from os import sys
> > from matplotlib import *
> > from numpy.random import rand
> >
> > while True:
> >
> > z= rand(20,20)
> > fig= pyplot.figure(figsize=(8,8), dpi=120)
> > pyplot.imshow(z)
> > pyplot.show()
> >
> > chr= sys.stdin.read(1)
> > if chr=='q': sys.exit(0)
> > --
> > View this message in context:
> > http://www.nabble.com/how-to-generate-one-plot-per-key-press--tp25100658p25100658.html
> > Sent from the matplotlib - users mailing list archive at Nabble.com.
> >
> >
> > ------------------------------------------------------------------------------
> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> > trial. Simplify your report design, integration and deployment - and focus
> > on
> > what you do best, core application coding. Discover what's new with
> > Crystal Reports now. http://p.sf.net/sfu/bobj-july
> > _______________________________________________
> > Matplotlib-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users