Pythondex
Turtle Python Programs

Draw A Heart Using Python Turtle

Last updated July 3, 2023 by Jarvis Silva

If you’re searching for a guide on drawing a heart using Python, you’ve come to the right place. This tutorial will show you how to draw a heart shape utilizing Python turtle. So follow this tutorial till the end.

To draw heart in python we will use turtle which is popular graphics library which can be used to draw shapes and designs in python.

So before moving forward you need to know the basic of python and turtle if you want to know how it actually draws a heart or if you don’t care about how it works just want to show it to your loved one then you are good to go.

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 for drawing 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.

Now you have the code you can run it but if you get any errors like turtle module not found then you need to install the turtle module mostly it comes preinstalled with python but if it doesn’t then install it by using the below command.


pip install turtle

So now you have everything setup and you are ready to run the program, After running you will see it opened a new window and started drawing the heart and below is the final drawing you will get.

Heart Drawing In Python

As you can see, we successfully drew a heart, I hope you were able to run this program successfully, You can also use this online python compiler to run this program.

Want to propose your boyfriend/girlfriend using a python program then follow this tutorial: I love you python program. If you have proposed your boyfriend/girlfriend and the proposal breaks your heart then we also have a python program for it: Broken heart using python.

I hope you found this tutorial helpful and useful. Do share this tutorial with your friends who might be interested in this program. 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 🙂