Explore

Close
Turtle Programs Share

Draw A Heart Using Python Turtle With Code

Draw A Heart Using Python Turtle With Code

Looking for a tutorial on how to draw a heart using python then you are at the right place, today in this tutorial I will show you how to draw a heart using python turtle so follow this tutorial till the end.

Drawing a heart in python is a little difficult but you don’t have to worry about anything. I will show you how to draw and provide you with the source code of this program.

Want to propose boyfriend/girlfriend then you can use this program: I love you python program. Disclaimer use it only on programmers.

Python Code To Draw A Heart


import turtle
wn = turtle.Screen()
wn.setup(width=400, height=400)
red = turtle.Turtle() 

def curve(): 
    for i in range(200): 
        red.right(1)
        red.forward(1)

def heart(): 
    red.fillcolor('red')
    red.begin_fill()
    red.left(140)
    red.forward(113)
    curve()
    red.left(120)
    curve() 
    red.forward(112)
    red.end_fill()

heart()
red.ht() 
turtle.done()

Above is the python program to draw a heart. 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 app.py

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

Heart Drawing In Python

As you can see, we successfully drew a heart 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 heart in python turtle. 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 tutorial 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 🙂