from turtle import *
from math import *
import time
import random
# ---------- Setup ----------
speed(0)
bgcolor("black")
hideturtle()
title("💖 Valentine Surprise 💖")
# ---------- Draw Flower Petals ----------
penup()
goto(0, -40)
pendown()
for i in range(16):
for j in range(18):
color('#FFA216')
rt(90)
circle(150 - j*6, 90)
lt(90)
circle(150 - j*6, 90)
rt(180)
circle(40, 24)
# ---------- Flower Center (Sunflower Pattern) ----------
shape("circle")
shapesize(0.45)
fillcolor("#8B4513")
color("black")
golden_angle = 137.508 * (pi / 180)
for i in range(160):
r = 4 * sqrt(i)
theta = i * golden_angle
penup()
goto(r * cos(theta), r * sin(theta))
setheading(i * 137.508)
pendown()
stamp()
# ---------- Dot Drawing Helper ----------
def point(x, y):
penup()
goto(x, y)
pendown()
color("black")
fillcolor("#FFA216")
begin_fill()
circle(4)
end_fill()
# ---------- Draw Letters ----------
def draw_T(x, y):
for i in range(5):
point(x + i*6, y + 30)
for i in range(6):
point(x + 12, y + 30 - i*6)
def draw_U(x, y):
for i in range(6):
point(x, y + 30 - i*6)
point(x + 24, y + 30 - i*6)
for i in range(1, 4):
point(x + i*6, y)
point(x + 12, y + 36)
point(x + 16, y + 40)
draw_T(-27, -20)
draw_U(7, -20)
# ---------- Typing Effect ----------
def type_text(text, x, y, color_text, size=20):
penup()
goto(x, y)
color(color_text)
for ch in text:
write(ch, font=("Arial", size, "bold"))
forward(size * 0.6)
time.sleep(0.08)
time.sleep(1)
type_text("Hey...", -40, -120, "white", 18)
time.sleep(0.6)
type_text("I have something to ask 💭", -130, -150, "#FFD700", 18)
time.sleep(0.8)
type_text("Will you be my Valentine?", -210, -185, "#FF4D6D", 20)
# ---------- Hearts ----------
def heart(x, y, size=10, col="#FF3366"):
penup()
goto(x, y)
pendown()
color(col)
begin_fill()
left(140)
forward(size)
circle(-size/2, 200)
left(120)
circle(-size/2, 200)
forward(size)
end_fill()
setheading(0)
for i in range(14):
heart(random.randint(-200, 200), random.randint(50, 200), 10)
time.sleep(0.12)
# ---------- Final Message ----------
time.sleep(0.8)
penup()
goto(-60, 220)
color("#FF69B4")
write("❤️ FOR YOU ❤️", font=("Arial", 22, "bold"))
done()
To embed this program on your website, copy the following code and paste it into your website's HTML: