Creating a turtle project in Python

Here’s how to create a turtle project:

Creating a Turtle project in Python

Hi all,

Today I’m Vaibhav Chakravarthi , 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():’
’ Turt.forward(move_speed)’

‘def backward():’
’ Turt.backward(move_speed)’

‘def left():’
’ Turt.left(move_speed)’

‘def right():’
’ Turt.right(move_speed)’
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

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

Vaibhav Chakravarthi