[Tutor] pylab Failure

Alan Gauld alan.gauld at btinternet.com
Sun Oct 12 08:21:24 CEST 2008


"Wayne Watson" <sierra_mtnview at sbcglobal.net> wrote
> Here's the code.
> If I just execute it, the terminal window opens briefly and 
> disappears.

What happens if you execute it from a terminal window?
That way any error messages will be visible.

What happens if you ruin it from inside IDLE or Pythonwin?

THe fact that you have a raw_input means the code should pause
at that point, if it isn't it probably suiggets a syntax error or 
similar
in the code before that point...

> from pylab import *
>
> def finish():
>    print; print "Bye"
>    print
>    raw_input('Press Enter to Quit')
>    sys.exit()
>
> t = arange(0.0, 2.0, 0.01)
> s = sin(2*pi*t)
> plot(t, s, linewidth=1.0)
>
> xlabel('time (s)')
> ylabel('voltage (mV)')
> title('About as simple as it gets, folks')
> grid(True)
> show()
> finish()

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list