Draw house using Turtle programming in Python
Last Updated :
28 Apr, 2025
Python's Turtle module provides a fun and interactive way to create graphics by controlling a turtle (pen) to draw on a screen. In this article, we will use Turtle to draw a simple house with a base, roof, door and windows. Lets see step by step how can we implement this in Python:
Step 1: Import Required Modules
Before starting, we need to import the required modules.
- turtle: To create graphical drawings.
- math: (Optional) Useful for geometric calculations, though not used in this example.
Python
import turtle
import math
Step 2: Set Up the Drawing Screen
To make our drawing visually appealing, we set a background color for the screen.
Python
screen = turtle.Screen()
screen.bgcolor("yellow") # You can choose any color
Step 3: Initialize the Turtle (Pen)
Before drawing, we configure the turtle:
- Set the color of the turtle.
- Change the shape to a turtle for better visualization.
- Adjust the speed for smooth drawing.
Python
t = turtle.Turtle()
t.color("black")
t.shape("turtle")
t.speed(3) # You can increase speed for faster drawing
Step 4: Draw the Base of the House
The base of the house is a rectangle. We fill it with cyan color to differentiate it from the roof.
Python
t.penup()
t.goto(-200, -200) # Moving turtle to starting position
t.pendown()
t.fillcolor("cyan") # Filling color for the base
t.begin_fill()
for _ in range(2):
t.forward(400) # Drawing width
t.left(90)
t.forward(250) # Drawing height
t.left(90)
t.end_fill()
Step 5: Draw the Roof (Triangle)
To create the roof, we need an isosceles triangle. We will use a brown color for the roof.
Python
t.fillcolor("brown") # Setting roof color
t.begin_fill()
t.goto(-200, 50) # Moving to first point of triangle
t.goto(0, 200) # Moving to top point of triangle
t.goto(200, 50) # Moving to last point of triangle
t.goto(-200, 50) # Completing the triangle
t.end_fill()
house_roofStep 6: Draw the Door and Windows
Now, let's add a door and windows to make the house realistic.
Python
t.penup()
t.goto(-50, -200) # Positioning for door
t.pendown()
t.fillcolor("red") # Filling door color
t.begin_fill()
for _ in range(2):
t.forward(100) # Door width
t.left(90)
t.forward(150) # Door height
t.left(90)
t.end_fill()
# Left window
t.penup()
t.goto(-150, -50) # Positioning for left window
t.pendown()
t.fillcolor("white") # Filling window color
t.begin_fill()
for _ in range(2):
t.forward(75) # Window width
t.left(90)
t.forward(75) # Window height
t.left(90)
t.end_fill()
# Right window
t.penup()
t.goto(75, -50) # Positioning for right window
t.pendown()
t.fillcolor("white")
t.begin_fill()
for _ in range(2):
t.forward(75)
t.left(90)
t.forward(75)
t.left(90)
t.end_fill()
Complete Code
Python
import turtle
screen = turtle.Screen()
screen.bgcolor("yellow")
t = turtle.Turtle()
t.color("black")
t.shape("turtle")
t.speed(3)
t.penup()
t.goto(-200, -200)
t.pendown()
t.fillcolor("cyan")
t.begin_fill()
for _ in range(2):
t.forward(400)
t.left(90)
t.forward(250)
t.left(90)
t.end_fill()
t.fillcolor("brown")
t.begin_fill()
t.goto(-200, 50)
t.goto(0, 200)
t.goto(200, 50)
t.goto(-200, 50)
t.end_fill()
t.penup()
t.goto(-50, -200)
t.pendown()
t.fillcolor("red")
t.begin_fill()
for _ in range(2):
t.forward(100)
t.left(90)
t.forward(150)
t.left(90)
t.end_fill()
t.penup()
t.goto(-150, -50)
t.pendown()
t.fillcolor("white")
t.begin_fill()
for _ in range(2):
t.forward(75)
t.left(90)
t.forward(75)
t.left(90)
t.end_fill()
t.penup()
t.goto(75, -50)
t.pendown()
t.fillcolor("white")
t.begin_fill()
for _ in range(2):
t.forward(75)
t.left(90)
t.forward(75)
t.left(90)
t.end_fill()
t.hideturtle()
turtle.done()
Output:
Related articles:
Similar Reads
Draw Panda Using Turtle Graphics in Python Pythonâs turtle module makes drawing fun and easy with simple commands. In this tutorial, weâll draw a cute panda step by step using basic functions like penup(), pendown(), setpos() and circle(). Steps to draw a PandaLet's understand the step-by-step approach to draw a panda using Pythonâs turtle m
2 min read
Turtle Programming in Python âTurtleâ is a Python feature like a drawing board, which lets us command a turtle to draw all over it! We can use functions like turtle.forward(...) and turtle.right(...) which can move the turtle around. Commonly used turtle methods are : MethodParameterDescriptionTurtle()NoneCreates and returns a
5 min read
Draw Graph Grid Using Turtle in Python Prerequisite: Turtle Programming Basics Turtle is an inbuilt module in Python. It provides drawing using a screen (cardboard) and turtle (pen). To draw something on the screen, we need to move the turtle (pen). To move turtle, there are some functions i.e forward(), backward(), etc. Approach: Follow
2 min read
Draw Ellipse Using Turtle in Python Prerequisite: Turtle Programming Basics Turtle is an inbuilt module in Python. It provides drawing using a screen (cardboard) and turtle (pen). To draw something on the screen, we need to move the turtle (pen). To move turtle, there are some functions i.e forward(), backward(), etc. Approach: The fo
2 min read
Draw a Hut using turtle module in Python Turtle is a inbuilt module in Python, which has many functions like forward(), backward(), right() and left() etc. You can draw a hut on the screen just by using the turtle module in Python. In this article, we will create a hut using the turtle module. Approach: Import turtleSet the background colo
2 min read
Draw moving object using Turtle in Python Prerequisite: Python Turtle Basics Turtle is an inbuilt module in python. It provides drawing using a screen (cardboard) and turtle (pen). To draw something on the screen, we need to move the turtle. To move turtle, there are some functions i.e forward(), backward(), etc. 1.)Move the Object (ball)
2 min read