Python has a graphics module called Turtle which is an easy way to start
exploring programming in an interesting way. These notes only apply to
Python 2.6 onwards as that was when the new turtle module was added.
In the Idle window, type the following:
 |
A new window should open with the following output. |
 |
The first 3 lines set up the turtle to draw.
Then it moves forward 200 pixels and turns left.
 |
You should eventually get the following output. If you make a
mistake and want to start again, just type
clearscreen()
and your graphics screen will clear and you can start again. |
 |
 |
|
Experiment and see what other things you can draw! |
|
 |
Saving Your Programs
Already you will have noticed that typing your code straight into
the IDLE window can become a bit tedious. It is better if you
can save the code you type. That way it is easier if you need
to fix mistakes, and you can reuse and modify code you have already
typed.
To save your programs, you need to open a New Window in IDLE.
Click File > New WIndow

Type your program into the New Window,
then click File > Save As
When you name your
program, you must type .py at the end of the filename, otherwise it
won't work properly.
Now your program is saved, you can run
it by choosing Run > Run Module (or just press F5)
 |
|