IDLE (Python GUI)
- Make sure the Python Interactive Development Environment (IDLE) is
installed on your PC.
- Create a folder (e.g. D:\Python3) to store all python scripts you
are going to develop.
- Make a copy of the "IDLE (Python GUI)" shortcut from the Start Menu.
- Right-click on the new shortcut icon and select "Properties".
- In the dialog box, delete the "Start in:" entry. The
properties should look similar as follows.
- Click OK.
- Double-click the "IDLE (Python GUI)" shortcut to start your Python
interpreter.
You may try to type following commands to see whether they work.
- print("Hello, World")
- print(2 + 3)
- print("2 + 3 =", 2+3)
Creating a Window
- 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).
- Double-click the "IDLE (Python GUI)" shortcut to start your Python
interpreter.
- Type "import graphics". If you just get the prompt back, that
means everything is fine.
- If you get the message "ImportError: No module named graphics",
that means Python was unable to find the file graphics.py. Check the
following:
- You named the file correctly (it must have the extension .py),
and place it in the proper directory.
- The property of your IDLE icon which you started the Python
interpreter has the "Start in:" entry cleared.
- Type "win = GraphWin()" to create a window.
- Type "win.close()" to close that window.
Drawing Objects in a Window
Try to draw the following objects:
- Circle
- Rectangle
- Line
- Text
- Oval