By the end of this lesson, you'll be able to:
Definition: Python Turtle is a module that can draw intricate shapes on the screen using commands.
Python Turtle is a fun way to see your code come to life in animation drawings! :art: Think of it as having a digital pen that follows your commands. While it's mainly used for learning Python, you'll be amazed at the creative artwork you can make!
:information_source: Remember! In real Python code, we use
import turtle
to bring in the Turtle module. In EduBlocks, we'll use the import blocks to do the same thing visually!
Let's create our first turtle drawing - a perfect square! :emoji: Here are the steps:
:bulb: Pro Tip!
You can name your turtle anything fun like "speedy", "artist", or "doodle"! Each variable represents one turtle. Want multiple turtles? Just create more variables!
Input | Output |
---|---|
![]() |
![]() |
:information_source: Remember! To draw a square, we move forward and turn 90 degrees, repeating this 4 times. In Python, this would be:
my_turtle.forward(100)
my_turtle.left(90)
# Repeat 4 times
Before we explore more commands, let's understand where our turtle lives! :emoji:️
Here is a graph of how the position coordinate works on the screen.
:bulb: Troubleshooting Tip!
If your turtle goes off-screen, don't worry! Use the
goto(0,0)
command to bring it back to the center.
Now let's learn how to make our turtle move! These are your turtle's superpowers: :emoji::emoji:️
Forward - Move straight ahead!
Left - Turn counter-clockwise (like turning a steering wheel left!)
Right - Turn clockwise (like turning a steering wheel right!)
Backward - Move in reverse!
:bulb: Quick Math!
- 90 degrees = quarter turn (like turning a corner)
- 180 degrees = half turn (turn around)
- 360 degrees = full turn (complete circle)
Ready to level up your turtle skills? Let's explore some amazing commands! :star2:
Circle - Draw perfect circles with ease!
:information_source: Remember! In Python, this would be
my_turtle.circle(50)
for a circle with radius 50!
Speed - Control how fast your turtle moves!
:bulb: Speed Settings
- 1 = Slowest (great for watching what happens)
- 5 = Medium speed
- 10 = Fastest animation
- 0 = Instant (great for complex drawings)
Go to - Teleport your turtle to any spot on the screen!
Did you know your turtle can transform? Change its appearance with different shapes! :emoji:
You can change your turtle's shape using the shape() block:
Classic - The default arrow shape
Turtle - A cute turtle shape!
Circle - A simple dot
Arrow - A pointer arrow
:bulb: Fun Fact!
In real Python, you'd write
my_turtle.shape("turtle")
to change to a turtle shape!
Think of your turtle as holding a real pen! :emoji:️ You can lift it up or put it down:
Pen Up - Lift the pen off the paper
Pen Down - Put the pen back on the paper
:bulb: When to Use Pen Up
Use pen up when you want to:
- Move to a new starting position
- Draw separate shapes
- Create dotted lines (pen up, move, pen down, repeat!)
To use it, you have to begin_fill before drawing a shape. Then, end_fill to stop filling after the shape is drawn.
Input | Output |
---|---|
![]() |
![]() |
The colour format can be written in 3 ways:
RGB 8 bits format.
The colour string such as "green", "red", "yellow", etc.
Hex code such as "#D291BC"
This will change the colour of Turtle shape, drawing line, and fill colour. The colour format can also be written in 3 ways.
The colour format can also be written in 3 ways.
To make this work, you have to first declare the variable for the screen. You can get the Screen() block from the Turtle category.
The Screen() variable will only need one as the screen. This is not compulsory.