Welcome, Young Coders!
Ready to become a coding superhero? With Python and Turtle, we will show you how draw cool shapes, create colorful patterns, and have a blast while you learn to code. Think of Turtle as your magical paintbrush that follows your instructions to make art on the screen. Let’s jump into this fun adventure and create awesome images with Python!

What is Turtle?
Getting Started: Setting Up Your Turtle Adventure
- Install Python:
- Follow the instructions to install it. Make sure to check “Add Python to PATH” during setup.
- Open a Coding Program:
- Use a program like IDLE (it comes with Python) or a kid-friendly editor like Thonny (download at thonny.org).
- These programs are where you will type your Turtle commands.
- Test your Python install works correctly:
- In Thonny there is a window with an untitled tab, type the following command there and then click the Run icon.
print("Hello World!")
- At the bottom of the Thonny program is the Shell window, when you execute the above command Hello World! should be printed there. The above command is known as a print statement.
Well done, that is your very first program!
Your First Turtle Adventure: Drawing a Line
- In Thonny click on the New icon to open a fresh window. Now enter the following commands into the untitled window like we did with our previous command (the print statement):
import turtle # Wake up the turtle!
turtle.forward(100) # Move forward 100 steps
turtle.done() # Tell the turtle to rest
What happened?
A new window opened called Python Turtle Graphics, and the turtle (represented by an arrowhead similar to a triangle) moved forward and drew a line, and the turtle is now sat at the end of that line. The number 100 tells the turtle how far to go.
To close the turtle window, click the Stop icon in Thonny, closing a program in this way makes sure it is closed correctly. Now, try changing 100 to 50 or 200 and click on the Run icon again to see what happens!


Fun Challenge:
Can you make the turtle draw a super long line?
Try turtle.forward(300)
Superhero Power: Comments!
import turtle
# Draw a square
turtle.forward(100) # Move forward
turtle.right(90) # Turn right
- They explain your code, so you do not forget.
- Comments also help friends understand your superhero plan.
- They make fixing mistakes easier.
Turning the Turtle: Making Shapes
import turtle
turtle.forward(100) # Move forward
turtle.left(90) # Turn left 90 degrees (like a corner)
turtle.forward(100) # Move forward again
turtle.done()
- turtle.left(90) makes the turtle turn left by 90 degrees (like turning a corner).
- Try turtle.right(90) to turn right instead.
Super Fun Shape: Draw a Square!
A square has 4 sides, and each corner is a 90-degree turn. Here is how to draw one using your turtle:
import turtle
turtle.forward(100) # Side 1
turtle.left(90)
turtle.forward(100) # Side 2
turtle.left(90)
turtle.forward(100) # Side 3
turtle.left(90)
turtle.forward(100) # Side 4
turtle.left(90)
turtle.done()
We can use less code to get the same result by using a loop to repeat the steps.

Loops: Making Drawing Easier
import turtle
for i in range(4): # Do this 4 times
turtle.forward(100) # Move forward
turtle.left(90) # Turn left
turtle.done()
- “for” is the type of loop we are using.
- “i” is increment, think of it as steps. The first time through the loop i = 0, every time the loop repeats i increases by 1.
- “range(4)” is how many steps or times we want to loop.
It’s like saying, “Draw a side and turn, then do it again 3 more times”, for a total of 4 times through the loop.

Fun Challenge:
- Change range(4) to range(3). What shape do you get?
- Try range(5) or range(6). What shapes can you make?
Adding Colors: Make It Pop!
import turtle
turtle.pencolor("blue") # Set pen color to blue
turtle.forward(100)
turtle.left(90)
turtle.pencolor("red") # Change to red
turtle.forward(100)
turtle.done()
- “green”, “purple”, “yellow”, “pink”, “orange”, or any color you can think of.
import turtle
turtle.fillcolor("yellow") # Fill with yellow
turtle.begin_fill() # Start filling
for i in range(4): # Draw a square
turtle.forward(100)
turtle.left(90)
turtle.end_fill() # Stop filling
turtle.done()
Try different colors for pencolor and fillcolor. Maybe a red outline with a green fill?


Fun Challenge:
Draw a blue triangle and fill it with purple!
Making It Fancy: Changing Pen Size and Speed
import turtle
turtle.pensize(5) # Make the pen thicker (5 pixels)
turtle.speed(3) # Set speed (1 is slow, 10 is fast)
turtle.forward(100)
turtle.left(90)
turtle.forward(100)
turtle.done()
- turtle.pensize(10) makes super thick lines.
- turtle.speed(1) makes the turtle draw slowly so you can watch it.
- turtle.speed(10) makes it zoom!


Fun Challenge:
Draw a thick, slow square and a thin, fast triangle!
Drawing Circles and Stars
import turtle
turtle.circle(50) # Draw a circle with radius 50
turtle.done()
What is radius?
It’s how big the circle is. Try turtle.circle(100) for a bigger circle or turtle.circle(20) for a tiny one.
import turtle
turtle.pencolor("gold") # Golden star
for i in range(5): # 5 points
turtle.forward(100)
turtle.right(144) # Special angle for stars
turtle.done()
Try changing the angle (144) to 120 or 150. What happens?

Moving Without Drawing: Jumping Around
import turtle
turtle.forward(50) # Draw a line
turtle.penup() # Lift the pen (no drawing)
turtle.forward(50) # Move without drawing
turtle.pendown() # Put the pen down
turtle.forward(50) # Draw again
turtle.done()

Fun Challenge:
Draw two squares side by side with a gap between them. Use penup to jump between squares!
Super Cool Project: Draw a Rainbow House
import turtle
# Draw the square base (red)
turtle.pencolor("red")
turtle.fillcolor("pink")
turtle.begin_fill()
for i in range(4):
turtle.forward(100)
turtle.left(90)
turtle.end_fill()
# Move to draw the triangle roof
turtle.penup()
turtle.goto(0, 100) # Jump to the top
turtle.pendown()
turtle.pencolor("blue")
turtle.fillcolor("purple")
turtle.begin_fill()
for i in range(3):
turtle.forward(100)
turtle.left(120) # 120 degrees for a triangle
turtle.end_fill()
# Draw a sun in the sky
turtle.penup()
turtle.goto(150, 150) # Jump to the sky
turtle.pendown()
turtle.pencolor("yellow")
turtle.fillcolor("orange")
turtle.begin_fill()
turtle.circle(30) # Draw a sun
turtle.end_fill()
turtle.done()
Try adding more details, like a door (a small square) or a tree (a circle on a line).
Saving Your Image
Call in Pillow’s Powers
- Windows Heroes: Search for “Command Prompt” in the Start menu (type cmd and hit Enter).
- Mac and Linux Heroes: Open “Terminal” (search for it using Spotlight or find it in Applications > Utilities).
- Why? This is like your superhero headquarters where you send commands to Python!
pip install Pillow
What’s Happening? pip is your trusty sidekick that grabs Pillow from the internet and installs it into Python. You’ll see some text zooming by as Pillow gets ready—cool, right?
Tip: If you get an error, try pip3 install Pillow instead, especially on a Mac. Ask a grown-up if you need backup!
import turtle
from PIL import Image
# Set up the turtle
t = turtle.Turtle()
t.speed(5)
# Add your code below! This code will draw a square
for _ in range(4):
t.forward(100)
t.right(90)
# Turtle code ends here
# Save as EPS (turtle format)
canvas = turtle.getscreen().getcanvas()
canvas.postscript(file="turtle_drawing.eps", colormode='color')
# Convert EPS to .PNG image
img = Image.open("turtle_drawing.eps")
img.save("turtle_drawing.png", "PNG")
# Keep the window open
turtle.done()
Superhero Tips
No Internet? Ask a grown-up to help download Pillow on another computer and transfer it to yours.
Stuck? If the command doesn’t work, make sure Python is installed and try again. You’ve got this, hero!
Why Pillow? It’s like giving Turtle a superpower to save drawings in formats everyone can see, not just secret .eps files.
With Pillow in your arsenal, you’re ready to save your Turtle creations like a true coding superhero! Keep drawing, keep coding, and let your imagination soar!
What You Have Learned
- Move the turtle (forward, left, and right).
- Draw shapes like squares, triangles, and circles.
- Use comments to explain your code.
- Use loops to repeat steps.
- Add colors and fill shapes.
- Change the pen size and drawing speed.
- Jump around without drawing (penup, pendown).
Keep Exploring!
- Draw a Flower: Use circles and loops to make petals.
- Make a Spiral: Draw a circle but make it bigger each time.
- Create a Pattern: Draw lots of shapes in different colors.
- Write Your Name: Use turtle.write(“Your Name”) to add text!