Open In App

Draw house using Turtle programming in Python

Last Updated : 28 Apr, 2025
Suggest changes
Share
Like Article
Like
Report

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() 
Roof
house_roof

Step 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:


Next Article

Similar Reads

Article Tags :
Practice Tags :