IDLE (Python GUI)

  1. Make sure the Python Interactive Development Environment (IDLE) is installed on your PC.
  2. Create a folder (e.g. D:\Python3) to store all python scripts you are going to develop.
    1. Make a copy of the "IDLE (Python GUI)" shortcut from the Start Menu.
    2. Right-click on the new shortcut icon and select "Properties".
    3. In the dialog box, delete the "Start in:" entry. The properties should look similar as follows.
    4. Click OK.
  3. Double-click the "IDLE (Python GUI)" shortcut to start your Python interpreter. You may try to type following commands to see whether they work.

Creating a Window

  1. Download graphics.py from http://mcsp.wartburg.edu/zelle/python/ and save it under a folder where you develop Python scripts (D:\Python3 in this example).
  2. Double-click the "IDLE (Python GUI)" shortcut to start your Python interpreter.
  3. Type "import graphics". If you just get the prompt back, that means everything is fine.
  4. If you get the message "ImportError: No module named graphics", that means Python was unable to find the file graphics.py. Check the following:
    1. You named the file correctly (it must have the extension .py), and place it in the proper directory.
    2. The property of your IDLE icon which you started the Python interpreter has the "Start in:" entry cleared.
  5. Type "win = GraphWin()" to create a window.
  6. Type "win.close()" to close that window.

Drawing Objects in a Window

Try to draw the following objects:
  1. Circle
  2. Rectangle
  3. Line
  4. Text
  5. Oval