[Tutor] *Newbie who needs help*

alan.gauld@bt.com alan.gauld@bt.com
Tue, 2 Apr 2002 15:06:12 +0100


> Okay, I've written a program in the python interpreter, but 
> how do i run the script in a new window, so i can try the 
> program out?

If you are using IDLE then create a new window(File|New) and
type the code into the empty window that appears. Save the 
file with an extension of .py (lets say you chose spam.py)

Now you have a choice:
1) either open a DOS box and at the DOS prompt type

C:\> python spam.py

And the program will run

2) In IDLE use Edit|Run (Ctrl-F5) to run the program with 
   output appearing in the IDLE shell window.

3) Use explorer to double click on spam.py
This will run your program in a DOS box then close the 
DOS Box. If you need to see the output then add a line like:

raw_input("Hit ENTER to close...")

at the end of the file. The program will run then display 
the prompt until you hit ENTER.

HTH,

Alan G.

PS If using ActiveState Python with Pythonwin then there 
are very similar menu items to IDLE there too.