Copyright Anne Dawson 2005 - 2010

This file is: http://www.annedawson.net/Python_Program_Run.htm
First created: Tuesday 8th March 2005, 7:28 PT, AD
Last updated: Thursday 3rd September 2009, 10:49 PT, AD

How to run Python 2.x or Python 3.0 programs using the IDLE editor

by Anne Dawson PhD

Which version of Python should you install?
Example Python 2.x Programs (HTML format)
Example Python 2.x Programs (text format)

Example Python 3.0 Programs (text format)

Python Programming Resources

Python Programming Hint Sheet

Python Useful Links






Follow these instructions to write and run a simple Python program using the IDLE editor:



Python installation screen 020




1.  Start IDLE (see screen above). You will then see a window entitled "Python Shell" ...


Python installation screen 022




2.  From the Python Shell window, select New Window from the File menu.

3.  You will see a window entitled "Untitled"



Python installation screen 024



4.  From the File menu, select Save As, 
     and select a folder to save your Python program file.

Python installation screen 026



5.  Select a folder to save your file in.

6.  In the File name: text box, type: program1.py

7.  Then click on the Save button. 
     You will then see a blank editor window ready 
     for you to type in your Python program.




Python installation screen 028





8.  The following program statement will run under Python 2.x or Python 3.0 

    Type in the following text into this window 
    (make sure the word print is all in lower case):

     print ("Hello World")

     If you're running Python 2.x, the text will automatically change colour to look like this:

     print("Hello World")

     If you're running Python 3.0.x, the text will automatically change colour to look like this:

     print("Hello World")




9.  To run this program, select Run Module from the Run menu.


     You should see a reminder to save the Source (your program). 
     Click on OK to save.

     Then you will see your program running in a Python Shell window.

Python 3 Shell




10.  Close all Python windows to quit Python.






IMPORTANT: 



To open your Python file again, 
locate the file in the folder, 
click once on the file name it to highlight it, 
then right-click on the mouse to see the options shown in
the screen below, and select Edit with IDLE 
to open the editor window. 


Python installation screen 030



From the editor window (the window with the program's name in the title bar),
select Run Module from the Run menu to 
see the program run in the Python Shell window.


****************************************************************
    To close a Python Shell or IDLE editor window
     Select Close from the File menu. 
****************************************************************
    To open and run an existing program file
     Select Open from the File menu.
****************************************************************
    Getting Help on IDLE
     Select IDLE Help from the Help menu
****************************************************************
    Getting Help on Python
     You select Python Docs from the Help menu or press keyboard key F1.
     The path for Python 3.0 is not correct - IDLE currently searches for documents here:
     http://docs.python.org/dev/3.0/ 
     when the Python 3 documentation is actually located here: http://docs.python.org/3.0/ 
Documentation for all versions of Python can be found here: http://docs.python.org
**************************************************************** To exit the Python Shell or IDLE editor Select Exit from the File menu. **************************************************************** Example Python 2.x Programs (HTML format) Example Python 2.x Programs (text format) Example Python 3.0 Programs (text format) Search for more computer science topics on www.annedawson.net

www.annedawson.net

Valid XHTML 1.0!

Valid CSS!