Learn to Code via Tutorials on Repl.it!

← Back to all posts
Here's how to create a turtle project:
awesomel (4)

Creating a Turtle project in Python

Hi all,

Today I'm @Awesomel, going to teach you how to create a turtle project!
So, Let's get started.

First we have four set on instructions together, those are to import the turtle, create a screen for the turtle, create a name for the turtle and a shape for the turtle:
import turtle
wn = turtle.Screen()
Turt = turtle.Turtle()
In this case, the name for my turtle is 'Turt'

In the next set of commands, we create a moving speed and a turning angle of the turtle:
move_speed = (10)
turn_angle = (20)
In this case, the moving speed and the turning angle for my turtle are 10 and 20 respectively.

In the next set of commands, we create forward, backward, left and right functions for the turtle:
def forward():

def backward():

def left():

def right():
Here, the moving speed of the turtle is set to our 'move_speed'

Next, we tell to the computer or the turtle that 'I will press the up, down, right and left keys to make the turtle move':
wn.onkey(forward, "Up")
wn.onkey(backward, "Down")
wn.onkey(right, "Right")
wn.onkey(left, "Left")
Here, I press the up, down, right and left key to make the turtle move forward, backward, right angle and left angle respectively.

Last but not the least, we tell the turtle to listen to us like how you should listen to your mom and dad:

And tada! your project is finished!
If you want to refer my project, you can click here

(Click the right, left, up and down buttons on your keyboard to move the turtle)
(Only works on desktop, computer, laptop, pc, mac or mac desktop)

Hope your project will be awesome!
You can share the project with me.
Thanking you all in advance.

Awesomel(Not my real name(My profile name))

ClarkeAdams (0)

Thanks for the article it was very helpful. I was actually looking for a guide to create a turtle project on Light Pink Puffer Jacket for Women and now I can do it thanks to your guide.

lussed (0)

The right angle and left angle respectively, happy wheels