SoFunction
Updated on 2024-10-28

Draw a little heart for your girl with python's turtle module.

Bored with studying at night.

Just happened to take his tablet and write a small program in python, using the turtle module to draw a small heart and draw the initials of his girlfriend's name on the heart, purely for the sake of the redhead.

The code is posted, it's very simple

import turtle
import time
def liujia():
 for i in range (200):
 (1)
 (1)
('red','pink')
(2)
(10)
(0,0)

turtle.begin_fill()
(140)
(112)
liujia()
(120)
liujia()
(112)
turtle.end_fill()
(5)
()
(-50,142.7)
(50)
()
(60)
(90)
(25)
()
(37.5,142.7)
()
(25)
()
(50,142.7)
(90)
()
(60)
for i in range (20):
 (7.8)
 (0.3)
(8)
()
(100,-10)
("I Love you")

It's ugly, but she's smiling.

code so should be good to understand it, folks old iron, do not ask how to change the name of the Internet to learn how to use the turtle library, it's very simple!

import turtle
import time
Name=['L','J']
def draw_circle():
  for i in range (200):
    (1)
    (1)
def draw_love():
  ('red','pink')
  (2)
  (1000)
  (0,0)
  turtle.begin_fill()
  (140)
  (112)
  draw_circle()
  (120)
  draw_circle()
  (112)
  turtle.end_fill()
def draw_name():
  (5)
  ()
  (-50,142.7)
  if Name[0]=='L':
    (50)
    ()
    (60)
    (90)
    (25)
  ()
  (37.5,142.7)
  if Name[1]=='J':
    ()
    (25)
    ()
    (50,142.7)
    (90)
    ()
    (60)
    for i in range (20):
      (7.8)
      (0.3)
    (8)
    ()
  (100,-10)
  ("I Love you")


draw_love()
draw_name()

Above this piece of python turtle module to achieve to the female ticket to draw a small heart is all I share with you, I hope to give you a reference, and I hope you support me more.