This Python Turtle cheat sheet lists 70 commands in 11 groups, each with a one-line example: moving and turning, the pen, colours and fills, shapes, text, clearing, animation and keyboard and mouse events. Every command name and alias was checked against the turtle module, and every example was run in Python 3.12. For the full reference, see the official turtle documentation.
Download the printable Python Turtle cheat sheet (PDF): the same commands on two A4 pages, ready to print.

Minimal Turtle program (starter template)
Every Turtle program follows the same pattern: import the module, create a screen and a turtle, give drawing commands, and finish with turtle.done() so the window stays open:
import turtle
screen = turtle.Screen()
t = turtle.Turtle()
t.forward(100)
t.left(90)
t.forward(100)
turtle.done()
The examples in the tables below assume screen and t were created like this.
Setup and the window
| Command | What it does | Example |
|---|---|---|
screen = turtle.Screen() | Create (or get) the drawing window | screen = turtle.Screen() |
t = turtle.Turtle() | Create a turtle to draw with | t = turtle.Turtle() |
screen.setup(width, height) | Window size in pixels | screen.setup(800, 600) |
screen.title(text) | Window title | screen.title("My drawing") |
screen.bgcolor(color) | Background colour | screen.bgcolor("lightblue") |
screen.bgpic(file) | Background image (GIF or PNG) | screen.bgpic("bg.gif") |
screen.screensize(w, h) | Size of the drawing area (adds scrollbars if larger than the window) | screen.screensize(1200, 900) |
screen.window_width() | Current window width (window_height() for height) | print(screen.window_width()) |
turtle.done() | Keep the window open until you close it; put it last | turtle.done() |
screen.exitonclick() | Close the window when it is clicked | screen.exitonclick() |
screen.bye() | Close the window from code | screen.bye() |
Move and turn
| Command | What it does | Example |
|---|---|---|
t.forward(distance)alias: fd | Move forward, drawing if the pen is down | t.forward(100) |
t.backward(distance)alias: bk, back | Move backward without turning | t.backward(50) |
t.right(angle)alias: rt | Turn clockwise by angle degrees | t.right(90) |
t.left(angle)alias: lt | Turn counterclockwise | t.left(45) |
t.goto(x, y)alias: setpos, setposition | Move to a point (draws a line if the pen is down) | t.goto(100, 50) |
t.teleport(x, y) | Jump to a point without drawing (Python 3.12+) | t.teleport(-100, 0) |
t.setx(x) / t.sety(y)alias: sety | Change only the x or only the y coordinate | t.setx(0) |
t.setheading(angle)alias: seth | Point in a direction: 0 east, 90 north, 180 west, 270 south | t.setheading(90) |
t.home() | Back to (0, 0), facing east | t.home() |
t.circle(radius, extent, steps) | Circle, arc or regular polygon; negative radius goes clockwise | t.circle(50, 180) |
t.dot(size, color) | Filled dot at the current position | t.dot(20, "red") |
t.stamp() | Print a copy of the turtle shape; returns an id | sid = t.stamp() |
t.clearstamp(id)alias: clearstamps | Remove one stamp (clearstamps() removes all) | t.clearstamp(sid) |
t.undo() | Undo the last action | t.undo() |
t.speed(speed) | 1 slowest to 10 fast, 0 = no animation; or "slow", "fast", "fastest" | t.speed(0) |
Turtle coordinates and headings
The centre of the window is (0, 0). x grows to the right and y grows upwards. Headings are measured counterclockwise from east:
import turtle
screen = turtle.Screen()
screen.setup(700, 520)
screen.title("Turtle coordinates and headings")
t = turtle.Turtle()
t.hideturtle()
t.speed(0)
def jump(x, y):
t.penup()
t.goto(x, y)
t.pendown()
t.color("#bbbbbb") # x and y axes
jump(-330, 0); t.goto(330, 0)
jump(0, -240); t.goto(0, 240)
t.color("black")
jump(8, 6)
t.write("(0, 0)", font=("Arial", 12, "normal"))
for x, y in [(200, 150), (-200, 150), (-200, -150), (200, -150)]:
jump(x, y)
t.dot(10, "#306998")
t.write(f" ({x}, {y})", font=("Arial", 12, "normal"))
arrow = turtle.Turtle(shape="arrow") # headings
arrow.color("#c62828")
arrow.penup()
arrow.speed(0)
for angle in (0, 90, 180, 270):
arrow.home()
arrow.setheading(angle)
arrow.forward(80)
arrow.stamp()
arrow.forward(34)
arrow.sety(arrow.ycor() - 9)
arrow.write(f"{angle}", align="center", font=("Arial", 14, "bold"))
arrow.hideturtle()
turtle.done()

circle(): circles, arcs and polygons
circle() draws around a centre that is radius units to the turtle’s left. extent draws part of the circle and steps turns it into a regular polygon:
import turtle
screen = turtle.Screen()
screen.setup(820, 360)
screen.title("circle() options")
t = turtle.Turtle()
t.speed(0)
t.pensize(3)
t.color("#306998")
examples = [("circle(50)", {"radius": 50}),
("circle(50, 180)", {"radius": 50, "extent": 180}),
("circle(50, steps=6)", {"radius": 50, "steps": 6}),
("circle(-50)", {"radius": -50})]
for i, (text, kwargs) in enumerate(examples):
x = -285 + i * 190
t.penup()
t.goto(x, -40 if kwargs["radius"] > 0 else 60)
t.setheading(0)
t.pendown()
t.circle(**kwargs)
t.penup()
t.goto(x, -90)
t.write(text, align="center", font=("Consolas", 11, "normal"))
t.hideturtle()
turtle.done()

Where is the turtle?
| Command | What it does | Example |
|---|---|---|
t.position()alias: pos | Current (x, y) | print(t.position()) |
t.xcor() / t.ycor()alias: ycor | Current x or y only | print(t.xcor(), t.ycor()) |
t.heading() | Current direction in degrees | print(t.heading()) |
t.towards(x, y) | Angle from the turtle to a point | t.setheading(t.towards(0, 100)) |
t.distance(x, y) | Distance to a point (or to another turtle) | print(t.distance(0, 0)) |
Pen
| Command | What it does | Example |
|---|---|---|
t.pendown()alias: pd, down | Draw when moving | t.pendown() |
t.penup()alias: pu, up | Move without drawing | t.penup() |
t.pensize(width)alias: width | Line thickness | t.pensize(5) |
t.isdown() | True if the pen is down | print(t.isdown()) |
t.pen(**settings) | Set several pen options at once | t.pen(pencolor="red", pensize=3) |
import turtle
screen = turtle.Screen()
screen.setup(640, 360)
screen.title("Pen size and colour")
t = turtle.Turtle()
t.speed(0)
t.hideturtle()
colors = ["black", "#306998", "#2e7d32", "#f9a825", "#c62828"]
for i, size in enumerate([1, 3, 6, 10, 16]):
y = 110 - i * 50
t.penup()
t.goto(-280, y)
t.pendown()
t.pensize(size)
t.pencolor(colors[i])
t.forward(300)
t.penup()
t.forward(20)
t.write(f"pensize({size})", font=("Consolas", 12, "normal"), align="left")
t.backward(20)
turtle.done()

Colour and fill
| Command | What it does | Example |
|---|---|---|
t.color(pen, fill) | Set pen and fill colour together | t.color("red", "yellow") |
t.pencolor(color) | Line and text colour: name, hex or RGB | t.pencolor("#306998") |
t.fillcolor(color) | Colour used by begin_fill()/end_fill() | t.fillcolor("gold") |
t.begin_fill() ... t.end_fill()alias: end_fill | Fill the shape drawn between the two calls | t.begin_fill(); t.circle(40); t.end_fill() |
t.filling() | True while a fill is in progress | print(t.filling()) |
screen.colormode(255) | Use RGB values 0 to 255 instead of 0 to 1 | screen.colormode(255); t.pencolor(255, 140, 0) |
Colours can be names ("red"), hex strings ("#306998") or RGB tuples. See Python Turtle colors for a full colour chart.
Turtle shape and visibility
| Command | What it does | Example |
|---|---|---|
t.shape(name) | "arrow", "turtle", "circle", "square", "triangle" or "classic" | t.shape("turtle") |
t.shapesize(w, l, outline)alias: turtlesize | Stretch the shape: width, length, outline | t.shapesize(2, 3, 1) |
t.hideturtle()alias: ht | Hide the turtle (drawing is faster) | t.hideturtle() |
t.showturtle()alias: st | Show it again | t.showturtle() |
t.isvisible() | True if the turtle is shown | print(t.isvisible()) |
t.tilt(angle) | Rotate the shape without changing the heading | t.tilt(30) |
screen.register_shape(file)alias: addshape | Use a GIF image as a turtle shape | screen.register_shape("star.gif"); t.shape("star.gif") |
screen.getshapes() | List the available shape names | print(screen.getshapes()) |
import turtle
screen = turtle.Screen()
screen.setup(660, 340)
screen.title("Turtle shapes")
label = turtle.Turtle(visible=False)
label.penup()
names = ["arrow", "turtle", "circle", "square", "triangle", "classic"]
for i, name in enumerate(names):
x = -250 + i * 100
t = turtle.Turtle(shape=name)
t.penup()
t.color("#306998", "#9ec5ff")
t.shapesize(2.5)
t.goto(x, 30)
label.goto(x, -50)
label.write(f'"{name}"', align="center", font=("Arial", 13, "normal"))
turtle.done()