
Last Updated on 11 May 2025

Introduction
When it comes to expressing love❤️, there are countless ways to do so. From verbal declarations to grand gestures, the possibilities are endless. But have you ever thought about expressing your love using a Python program?
That’s right, with a little bit of Python, you can create a program that tells someone how much you love him/her. In this tutorial, I will show you how you can say I Love You using a Python Program. We will implement this idea using the Python Turtle module.
So, let’s get started.
Requirements and Installations
Please make sure Python is installed on your system. Grab the latest version from their website (https://www.python.org/). Once settled, remember to install the Turtle module and pygame library using the command below.
pip install PythonTurtle pip install pygame
Import the Modules
Create a separate folder named ‘I-Love-You-in-Python‘ for this topic, and declare a Python file with the name ILoveYou.py. Now, start writing your code by importing these modules.
import turtle import time from pygame import mixer
Initialize Turtle Module
Let’s initialize the Turtle module.
t = turtle.Turtle()
Initialize the PyGame Mixer
Now, let’s initiate the PyGame mixer to play background music. Download the .mp3 file using the ‘Download’ button below and place it within the ‘I-Love-You-in-Python’ folder.
mixer.pre_init(frequency=48000, size=-16, channels=2, buffer=512)
mixer.init()
mixer.music.load("memories.mp3")
Set the Background Window
Let’s set the Turtle window settings, including background color and size. I’ve chosen a black background, but feel free to customize it to your preference.
The window size I’ve set is 800×700, but you can modify it according to your preferences.
window = turtle.Screen()
window.bgcolor('black')
window.screensize(800, 700)
window.setup(width=1.0, height=1.0, startx=None, starty=None)
Play the Music
Let’s start playing the music you have added, just one step before.
mixer.music.play()
Draw the ‘I’ Letter
Now, we’ll start drawing with the letter ‘I.’ It’s a pretty straightforward process. In this step, we guide our Turtle using various numerical commands for moving forward, backward, left, right, and turning around at different angles.
t.penup() t.goto(-80,300) time.sleep(1) t.pendown() t.shapesize(1,2,1) # 'I' t.pen(pencolor="white",fillcolor="dark violet", pensize=3, speed=8) t.begin_fill() t.fd(160) t.rt(90) t.fd(25) t.rt(90) t.fd(60) t.lt(90) # Height of 'I' t.fd(140) t.lt(90) t.fd(60) t.rt(90) t.fd(25) t.rt(90) t.fd(160) t.rt(90) t.fd(25) t.rt(90) t.fd(60) t.lt(90) t.fd(140) t.left(90) t.fd(60) t.rt(90) t.fd(25) t.end_fill() # End of 'I'
Draw the ‘Love’ Word
Hopefully, your code is successfully creating the ‘I’ letter. Now, let’s proceed to write the entire word ‘Love.’ The logic remains the same as before. So, let’s express your love through this segment of code.
t.penup() t.goto(-550,-20) t.pendown() # Word: 'Love' # 'L' t.pen(pencolor="white",fillcolor="dark violet", pensize=3, speed=2) t.begin_fill() t.rt(90) t.fd(25) t.rt(90) t.fd(165) t.lt(90) t.fd(115) t.rt(90) t.fd(25) t.rt(90) t.fd(140) t.rt(90) t.fd(190) t.rt(90) t.end_fill() # End of 'L' t.penup() t.fd(140) # Gap between 'L' and 'O' t.fd(70) # 'O' t.pen(pencolor="white",fillcolor="cyan", pensize=3, speed=8) t.begin_fill() t.rt(90) t.fd(190) t.lt(90) t.pendown() t.circle(60) t.lt(90) t.penup() t.fd(20) t.rt(90) t.pendown() t.circle(40) t.rt(90) t.penup() t.fd(20) t.lt(90) t.end_fill() # End of 'O' # Gap between 'O' and 'V' t.fd(100) t.pendown() # 'V' t.pen(pencolor="white",fillcolor="dark violet", pensize=3, speed=8) t.begin_fill() t.lt(100) t.fd(120) t.rt(100) t.fd(20) t.rt(80) t.fd(100) t.lt(80) t.fd(20) t.lt(80) t.fd(100) t.rt(80) t.fd(20) t.rt(100) t.fd(120) t.rt(80) t.fd(50) t.lt(180) t.end_fill() # End of 'V' t.penup() # Gap between 'V' and 'E' t.fd(100) t.pendown() # 'E' t.pen(pencolor="white",fillcolor="dark violet", pensize=3, speed=8) t.begin_fill() t.lt(90) t.fd(120) t.rt(90) t.fd(80) t.rt(90) t.fd(20) t.rt(90) t.fd(60) t.lt(90) t.fd(30) t.lt(90) t.fd(60) t.rt(90) t.fd(20) t.rt(90) t.fd(60) t.lt(90) t.fd(30) t.lt(90) t.fd(60) t.rt(90) t.fd(20) t.rt(90) t.fd(80) t.end_fill() # End of 'E' # End of 'Love'
Draw the ‘You’ Word
We’ve effectively displayed ‘I’ and ‘Love’ using our Python program. Let’s finalize both this sentence and your feelings towards him/her. This part of the code will draw the word ‘You’ on the screen.
# Start of 'You' # 'Y' t.pen(pencolor="white",fillcolor="dark violet", pensize=3, speed=2) t.begin_fill() t.lt(90) t.fd(50) t.lt(30) t.fd(80) t.rt(120) t.fd(20) t.rt(60) t.fd(60) t.lt(180) t.rt(60) t.fd(60) t.rt(60) t.fd(20) t.rt(120) t.fd(80) t.lt(30) t.fd(50) t.rt(90) t.fd(20) t.rt(180) t.end_fill() # End of 'Y' t.penup() # Gap between 'Y' and 'O' t.fd(120) t.pendown() # 'O' t.pen(pencolor="white",fillcolor="cyan", pensize=3, speed=8) t.begin_fill() t.circle(60) t.lt(90) t.penup() t.fd(20) t.pendown() t.rt(90) t.circle(40) t.rt(90) t.penup() t.fd(20) t.lt(90) t.end_fill() # End of 'O' # Gap between 'O' and 'U' t.fd(100) t.circle(60, extent=60) t.pendown() # 'U' t.pen(pencolor="white",fillcolor="dark violet", pensize=3, speed=8) t.begin_fill() t.lt(30) # Height of 'U' t.fd(85) t.lt(90) t.fd(20) t.lt(90) t.fd(70) t.circle(-20, extent=180) t.fd(70) t.lt(90) t.fd(20) t.lt(90) t.fd(85) t.circle(40, extent=180) t.end_fill() # End of 'U' # End of 'You' t.penup() # t.goto(300,130) t.rt(180) t.fd(35) t.lt(90) t.fd(140) t.lt(90) t.pendown()
Define the ‘curve’ Function
Our program successfully illustrates ‘I Love You.’ While everything is already perfect, imagine how it would look with the addition of a love sign at the end. Pretty great, isn’t it? Let’s enhance it.
Define the curve function at the beginning of the program. This function will assist in drawing a prominent love sign for your special someone. Insert the code below at the top. This function will create curves for the love sign.
t = turtle.Turtle()
def curve():
t.pen(pencolor="white", pensize=3, speed=5)
for i in range(200):
t.rt(1)
t.fd(1)
Define a Function to Draw a Big Love Symbol
Add this love_symbol function just after the previous code.
def love_sign():
t.pen(pencolor="white",fillcolor="hot pink", pensize=3, speed=5)
t.shape("turtle")
t.shapesize(1,1,1)
t.begin_fill()
t.lt(50)
t.fd(113)
curve()
t.lt(120)
curve()
t.fd(112)
t.end_fill()
t.hideturtle()
Call the ‘love_symbol’ Function
We are at the very end of our I Love You Python Program. In the last two sections, we defined two functions to draw a prominent Love symbol adjacent to the ‘I Love You.’
In this section, we will invoke the love_symbol function, which, in turn, will utilize the curve function to draw a beautiful Love symbol.
# Calling the function for Love Sign love_sign() time.sleep(5)
Complete Code
Here is the complete Source Code for your convenience.
import turtle
import time
from pygame import mixer
mixer.pre_init(frequency=48000, size=-16, channels=2, buffer=512)
mixer.init()
mixer.music.load("memories.mp3")
t = turtle.Turtle()
def curve():
t.pen(pencolor="white", pensize=3, speed=5)
for i in range(200):
t.rt(1)
t.fd(1)
def love_sign():
t.pen(pencolor="white",fillcolor="hot pink", pensize=3, speed=5)
t.shape("turtle")
t.shapesize(1,1,1)
t.begin_fill()
t.lt(50)
t.fd(113)
curve()
t.lt(120)
curve()
t.fd(112)
t.end_fill()
t.hideturtle()
window = turtle.Screen()
window.bgcolor('black')
window.screensize(800, 700)
window.setup(width=1.0, height=1.0, startx=None, starty=None)
# Play Music
mixer.music.play()
t.penup()
t.goto(-80,300)
time.sleep(1)
t.pendown()
t.shapesize(1,2,1)
# 'I'
t.pen(pencolor="white",fillcolor="dark violet", pensize=3, speed=8)
t.begin_fill()
t.fd(160)
t.rt(90)
t.fd(25)
t.rt(90)
t.fd(60)
t.lt(90)
# Height of 'I'
t.fd(140)
t.lt(90)
t.fd(60)
t.rt(90)
t.fd(25)
t.rt(90)
t.fd(160)
t.rt(90)
t.fd(25)
t.rt(90)
t.fd(60)
t.lt(90)
t.fd(140)
t.left(90)
t.fd(60)
t.rt(90)
t.fd(25)
t.end_fill()
# End of 'I'
t.penup()
t.goto(-550,-20)
t.pendown()
# Word: 'Love'
# 'L'
t.pen(pencolor="white",fillcolor="dark violet", pensize=3, speed=2)
t.begin_fill()
t.rt(90)
t.fd(25)
t.rt(90)
t.fd(165)
t.lt(90)
t.fd(115)
t.rt(90)
t.fd(25)
t.rt(90)
t.fd(140)
t.rt(90)
t.fd(190)
t.rt(90)
t.end_fill()
# End of 'L'
t.penup()
t.fd(140)
# Gap between 'L' and 'O'
t.fd(70)
# 'O'
t.pen(pencolor="white",fillcolor="cyan", pensize=3, speed=8)
t.begin_fill()
t.rt(90)
t.fd(190)
t.lt(90)
t.pendown()
t.circle(60)
t.lt(90)
t.penup()
t.fd(20)
t.rt(90)
t.pendown()
t.circle(40)
t.rt(90)
t.penup()
t.fd(20)
t.lt(90)
t.end_fill()
# End of 'O'
# Gap between 'O' and 'V'
t.fd(100)
t.pendown()
# 'V'
t.pen(pencolor="white",fillcolor="dark violet", pensize=3, speed=8)
t.begin_fill()
t.lt(100)
t.fd(120)
t.rt(100)
t.fd(20)
t.rt(80)
t.fd(100)
t.lt(80)
t.fd(20)
t.lt(80)
t.fd(100)
t.rt(80)
t.fd(20)
t.rt(100)
t.fd(120)
t.rt(80)
t.fd(50)
t.lt(180)
t.end_fill()
# End of 'V'
t.penup()
# Gap between 'V' and 'E'
t.fd(100)
t.pendown()
# 'E'
t.pen(pencolor="white",fillcolor="dark violet", pensize=3, speed=8)
t.begin_fill()
t.lt(90)
t.fd(120)
t.rt(90)
t.fd(80)
t.rt(90)
t.fd(20)
t.rt(90)
t.fd(60)
t.lt(90)
t.fd(30)
t.lt(90)
t.fd(60)
t.rt(90)
t.fd(20)
t.rt(90)
t.fd(60)
t.lt(90)
t.fd(30)
t.lt(90)
t.fd(60)
t.rt(90)
t.fd(20)
t.rt(90)
t.fd(80)
t.end_fill()
# End of 'E'
# End of 'Love'
t.penup()
t.rt(180)
# Gap between 'E' and 'Y'
t.fd(200)
t.pendown()
# Start of 'You'
# 'Y'
t.pen(pencolor="white",fillcolor="dark violet", pensize=3, speed=2)
t.begin_fill()
t.lt(90)
t.fd(50)
t.lt(30)
t.fd(80)
t.rt(120)
t.fd(20)
t.rt(60)
t.fd(60)
t.lt(180)
t.rt(60)
t.fd(60)
t.rt(60)
t.fd(20)
t.rt(120)
t.fd(80)
t.lt(30)
t.fd(50)
t.rt(90)
t.fd(20)
t.rt(180)
t.end_fill()
# End of 'Y'
t.penup()
# Gap between 'Y' and 'O'
t.fd(120)
t.pendown()
# 'O'
t.pen(pencolor="white",fillcolor="cyan", pensize=3, speed=8)
t.begin_fill()
t.circle(60)
t.lt(90)
t.penup()
t.fd(20)
t.pendown()
t.rt(90)
t.circle(40)
t.rt(90)
t.penup()
t.fd(20)
t.lt(90)
t.end_fill()
# End of 'O'
# Gap between 'O' and 'U'
t.fd(100)
t.circle(60, extent=60)
t.pendown()
# 'U'
t.pen(pencolor="white",fillcolor="dark violet", pensize=3, speed=8)
t.begin_fill()
t.lt(30)
# Height of 'U'
t.fd(85)
t.lt(90)
t.fd(20)
t.lt(90)
t.fd(70)
t.circle(-20, extent=180)
t.fd(70)
t.lt(90)
t.fd(20)
t.lt(90)
t.fd(85)
t.circle(40, extent=180)
t.end_fill()
# End of 'U'
# End of 'You'
t.penup()
# t.goto(300,130)
t.rt(180)
t.fd(35)
t.lt(90)
t.fd(140)
t.lt(90)
t.pendown()
# Calling the function for Love Sign
love_sign()
time.sleep(5)
Output
The above program outputs the following:

Summary
In this tutorial, we created a journey where lines of Python code weave a love story. Using the Turtle module, we create a Program to say I Love You in Python in a visual way with letters and symbols for your special someone.
As the Python script runs, each line drawn on the screen tells a love story. Starting with ‘I,’ moving through ‘Love,’ and ending with ‘You,’ the code becomes a canvas expressing feelings.
So, express your feelings in Python, where each line of code tells a story, and love is shown not just in words but in the beauty of programming.
Run the code, play the music, and see your emotions on the screen.
Want more coding adventures? Dive into the secret stash of Cool Python Programs hidden behind this portal🪄. Below are a few examples to spark your interest.✨
- Wish Happy Birthday using Python Programs
- Communicate with Your Friends Secretly Using Python
- Draw the Sketch of Lionel Messi using a Python Program
- Create a Time Wasting Websites Blocker using Python
If you have any burning questions about this topic, reach out to me at contact@pyseek.com.
If this article helped you, feel free to support me on Buy Me a Coffee.
Happy Coding!



