Draw a House in Python Turtle
Beginner · Things to draw · 119 lines · draws in about 15 seconds
One rectangle function draws the sky, grass, walls, door, windows and chimney, and the order of the calls decides what sits in front.

How the code works
One function, many rectangles
rectangle() goes to the bottom left corner, then does forward, left turn, forward, left turn twice. Every rectangle in the picture, from the sky to the door, is one call to it.
def rectangle(x, y, width, height, color): # A filled rectangle with its bottom left corner at (x, y) t.penup() t.goto(x, y) t.setheading(0) t.pendown() t.color(color) t.begin_fill() for _ in range(2): t.forward(width) t.left(90) t.forward(height) t.left(90) t.end_fill()
Chimney before roof
Later drawings cover earlier ones. The chimney goes first and reaches above the roof, so the roof hides its bottom and it looks like it comes out of the tiles. The roof is a triangle made with three goto() calls.
# The chimney goes first, so the roof covers its bottom rectangle(60, 50, 35, 80, "sienna") # The walls and the roof rectangle(-130, -150, 260, 180, "wheat") t.penup() t.goto(-160, 30) t.pendown() t.color("firebrick") t.begin_fill() t.goto(160, 30) t.goto(0, 140) t.goto(-160, 30) t.end_fill()
Windows with crosses
The loop runs once with x set to -105 and once with 45. Each time it draws a light blue rectangle and two white lines across its middle.
# Two windows, each with a white cross in the middle for x in [-105, 45]: rectangle(x, -75, 60, 55, "lightblue") t.pensize(4) t.pencolor("white") t.penup() t.goto(x + 30, -75) t.pendown() t.goto(x + 30, -20) t.penup() t.goto(x, -47) t.pendown() t.goto(x + 60, -47) t.pensize(1)
The garden
flower() draws a green stem with two dots on top. The loop puts four flowers on each side of the path, 35 apart, and colors[i] gives each one a different colour.
# Bushes by the walls and flowers along the front t.penup() t.goto(-135, -140) t.dot(50, "seagreen") t.goto(135, -140) t.dot(50, "seagreen") colors = ["red", "hotpink", "orange", "mediumorchid"] for i in range(4): flower(-270 + i * 35, -200, colors[i]) flower(165 + i * 35, -200, colors[i])
Make it yours
Change the code above and press Run. Some ideas:
- Change
"firebrick"to"slategray"for a grey roof. - Add
rectangle(-20, -40, 40, 30, "lightblue")after the windows for a small window above the door. - Move the sun to the other side with
t.goto(230, 160)in place oft.goto(-230, 160).
What it uses
- functions with parameters
- begin_fill and end_fill
- drawing order
- for loops
Every turtle command the site supports is listed on Python turtle online.