You are on page 1of 4

Chapter 2 Python and Turtles Example rectangle

Turtle is a drawing tool that can be controlled by specific turtle commands. The
commands are used to controlled movement of the turtle (or pen’s tip), or control
the setting of colour or size of the pen.

So let’s begin your program with this line,

import turtle

After this command is called, you will have all functionality of a turtle.
If you get tired of typing turtle. then you can give your turtle a nickname. Any name
you would like to call it. For example import turtle as t or even import turtle as
kitty. Then use that name instead of the word turtle.

Example
Example Mickey mouse Example half-circles

when we call a command turtle.circle(100), the turtle will draw a full circle.

But if we just want to draw part of a circle, then we have to specify the second
parameter, to indicate the angle of the circle we need to draw.

This time we are going to use turtle.circle(100,180) command to draw an arc of half
a circle.

A Mickey mouse will consist of 3 filled circle or 3 dots. One dot in the centre and
two smaller dots on the upper left and upper right.

when the turtle is initialised, it is placed at coordinates (0,0) on a cartesian plane. At


that point we place a dot of size 200 pixels.

We then move our turtle to the coordinates (-90,90) which is 90 pixels to the left
and and 90 pixels up compared to the centre (0,0)

we instruct the turtle to draw a straight line back to the original (0,0). Then we fill
that half circle with what ever colour we want. I have chosen, blue, yellow, #FE642E
and #FF0040. The last two colours are HTML colour code, which I picked from
http://html-color-codes.info/.
Example BMW logo

You might also like