/* jquery */ /* jquery accordion style*/ /* jquery init */

20 May 2013

Learn Python - Tom The Turtle

Up to now we've drawn some patterns and shapes, but we've seen nothing that looks much like a turtle. Let's put that right.

Before starting to issue move commands we can create a turtle object. We can give this object a name, and define a turtle-like shape.

It's done like this:

tom = turtle()
tom.shape("turtle")
tom.color("red")

These three lines will create a turtle called Tom, with a real turtle shape, filled with a bright red colour.

We can command Tom to move around the around the screen just as before, like this:

tom.circle(100)
tom.right(45)

Next time I'll show you how to control two turtles at once for some synchronised stomping.

A post from my Learn Python on the Raspberry Pi tutorial.