Make a Turtle Drawing Game in Python for Kids

Let’s make a Turtle drawing game in Python. Turtle is a built-in Python module that moves a little turtle across the screen and draws as it goes. Perfect for kids who like art + code.

Setup

Use a computer with Python installed. Create a file named turtle_game.py.

Step 1: Draw a square

import turtle

t = turtle.Turtle()
t.pensize(3)
t.color("blue")

for i in range(4):
    t.forward(100)
    t.right(90)

turtle.done()

Step 2: Make a colorful star

import turtle

t = turtle.Turtle()
t.speed(8)
colors = ["red", "orange", "yellow", "green", "blue", "purple"]

for i in range(36):
    t.color(colors[i % 6])
    t.forward(120)
    t.right(170)

turtle.done()

Step 3: Keyboard mini-game

import turtle

screen = turtle.Screen()
t = turtle.Turtle()
t.shape("turtle")
t.color("green")
t.pensize(2)

def go_up():
    t.setheading(90)
    t.forward(20)

def go_down():
    t.setheading(270)
    t.forward(20)

def go_left():
    t.setheading(180)
    t.forward(20)

def go_right():
    t.setheading(0)
    t.forward(20)

screen.listen()
screen.onkey(go_up, "Up")
screen.onkey(go_down, "Down")
screen.onkey(go_left, "Left")
screen.onkey(go_right, "Right")
turtle.done()

Use the arrow keys to drive your turtle and draw a maze path!

Challenge ideas

  • Draw your initials
  • Make a house with a triangle roof
  • Change colors every time you press a key

What you learned

Loops, functions, events (key presses), and creative coding. Turtle is a bridge from Scratch-style fun to typed Python power.

Next Post Previous Post
No Comment
Add Comment
comment url