[Tutor] help.. just getting started

Alan Gauld alan.gauld at blueyonder.co.uk
Sat Sep 13 04:05:56 EDT 2003


> I think I have python.. When I go to cmd and type python then I get
a prompt
> like this:
> >>>>
> and when I type
> >>>>import Image
> etc etc then I get no errors so its all good...

Yes that's Python working in interactive mode so you can
type commands in and try things out.

> However, on the VTK home page I've downloaded all these examples and
things
> so how do I compile and execute and view the source code of these
> examples...???

You need to type the code into a new file (in Notepad or some
other text editor) and make the file extension .py.

Then you can just click the file in explorer and it will run under
python.

Alternatively you can run it from the cmd box by typing:

C:\WINDOWS> python myfile.py

And if it runs too quickly to see the output you can run it as:

C:\WINDOWS> python -i myfile.py

which will run the program and leave the python >>> prompt.
That way you will see the final screenful of output at least!
(This also makes it easy to check the values of variables etc
at the end of your program if things don't work quite as expected!)

HTH,

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Tutor mailing list