1. Pyroom
  2. Tutorials
  3. Python Turtle

Python Turtle

Turtle graphics turn code into drawings: every forward() and left() moves a pen you can see, which makes loops and functions easy to understand.

When to use it

Use turtle for a first programming course, geometry and pattern lessons, or any time students learn best by seeing the result of each line.

Start drawing

Write from turtle import * at the top of your program. When you press Run, a preview panel opens next to the console and the turtle draws as your code executes. Use forward(), left(), right(), pencolor() and fillcolor() to control it.

from turtle import *
for side in range(4):
    forward(100)
    left(90)

From shapes to patterns

Once a square works, put it in a loop and turn a little each time β€” a rosette appears. Change one number, run again and watch the pattern change. This is the fastest way to build a feeling for what a loop really repeats.

Learning path

  • Beginner: draw a square and change its size and colour.
  • Intermediate: draw spirals with loops and growing step sizes.
  • Advanced: react to the keyboard with onkey() and animate the turtle.

Good to know

Pyroom runs turtle in the browser, so it works on Chromebooks, tablets and phones. Use speed(0) or tracer() for faster drawings. Share a drawing with a link or QR code so classmates can run it too.

Feature overview β†’

Beginner

Draw a square with Python turtle

Beginner

Beginner Video coming soon. The steps below show everything the video will cover.

Draw your first shape with Python turtle in the browser: move forward, turn left and repeat four times. Free beginner tutorial.

Open tutorial β†’

Intermediate

Advanced

Control a turtle with the keyboard

Advanced

Advanced Video coming soon. The steps below show everything the video will cover.

Make an interactive Python turtle program: bind arrow keys with onkey(), listen for presses and move the turtle. Advanced tutorial.

Open tutorial β†’

All tutorials β†’

Try it in the Playground

Nothing to install and no account needed.

Open Playground β†’