Explore

Close
Turtle Programs Share

Draw A House Using Python Turtle With Code

Draw A House Using Python Turtle With Code

Want to draw a house using python, then you are at the right place today. In this tutorial I will show you how to draw a house using python turtle programming, so follow this tutorial till the end.

We will use the turtle library in python to draw the house. Turtle module can be used to draw anything in python, you can check here python turtle drawing programs.

If you don’t know how to use the turtle module then don’t worry, I will show you how to draw a house in python and provide you with the code of this program.

Python Code To Draw A House


import turtle

t = turtle.Turtle()

screen = turtle.Screen()
screen.bgcolor("#f9fafc")

t.color("black")
t.shape("turtle")
t.speed(2)

# for creating base of the house
t.fillcolor('yellow')
t.begin_fill()
t.right(90)
t.forward(250)
t.left(90)
t.forward(400)
t.left(90)
t.forward(250)
t.left(90)
t.forward(400)
t.right(90)
t.end_fill()

# for top of the house
t.fillcolor('red')
t.begin_fill()
t.right(45)
t.forward(200)
t.right(90)
t.forward(200)
t.left(180)
t.forward(200)
t.right(135)
t.forward(259)
t.right(90)
t.forward(142)
t.end_fill()

# for door and windows
t.right(90)
t.forward(400)
t.left(90)
t.forward(50)
t.left(90)
t.forward(150)
t.right(90)
t.forward(200)
t.right(180)
t.forward(200)
t.right(90)
t.forward(200)
t.right(90)
t.forward(150)
t.right(90)
t.forward(200)
t.right(90)
t.forward(150)
t.right(90)
t.forward(100)
t.right(90)
t.forward(150)
t.right(90)
t.forward(100)
t.right(90)
t.forward(75)
t.right(90)
t.forward(200)
t.right(180)
t.forward(200)
t.right(90)
t.forward(75)
t.left(90)
t.forward(15)
t.left(90)
t.forward(200)
t.right(90)
t.forward(15)
t.right(90)
t.forward(75)

Above is the python program to draw a house Now to run this program you need to have python installed on your computer, If you don’t have then follow this guide: Install and setup python on your computer.

To run this python program, follow the below steps:

  • Create a new folder for this python project.
  • Open it in a code editor of your choice.
  • Create a python file with an ending .py extension.
  • Copy the above code and paste it in your file.

Now you have the code, but there is one last thing you need to do as I have said I have used the turtle library for this program so you might need to install it if you get any errors like turtle module not found.

Turtle comes pre-installed with python setup, but if you get any errors you can reinstall it using the below command.


pip install turtle

So now you have everything setup and you are ready to run the program, so to run this program open a command prompt at your program folder location and paste the below command.


python filename.py

The above command will run the program and it will open a new window and it will start drawing a house and below is the finished drawing of the house.

House Drawing In Python

As you can see, we successfully drew a house using python turtle. I hope you were able to run this program successfully. 

Don’t want to create all the files and folders then you can run this program now using this online python compiler it is fast and easy.

Summary

This was the tutorial on drawing a house in python programming. I hope you found this tutorial helpful and useful. Do share this tutorial with your friends who might be interested in this program.

Here are some more python drawing tutorials for you:

I hope you found what you were looking for from this tutorial, and if you want more python guides and tutorials like this, do join our Telegram channel for future updates.

Thanks for reading, have a nice day 🙂