-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathlove2.py
58 lines (50 loc) · 1.4 KB
/
love2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 何书悦GitHub爱心代码项目https://github.com/heshuyue/love-code
import turtle
import time
def LittleHeart():
for i in range(200):
turtle.right(1)
turtle.forward(2)
# love = input('请输入表白语句,然后回车,默认为"I Love You":\n')
# me = input('请输入要表白的人:\n')
# if love=='':
# # 如果未输入表白语句,则使用默认语句
# love='I Love you'
love='I Love you'
me = '我喜欢你'
turtle.setup(width=900,height=600) # 爱心的画布的大小
turtle.color('red','red') # 爱心的颜色及外边笔的颜色
turtle.pensize(10) # 画笔的粗细
turtle.speed(100000000) # 绘制速度
turtle.up() # 画笔向上
turtle.hideturtle()
turtle.goto(0,-180)
turtle.showturtle()
turtle.down()
turtle.speed(5)
turtle.begin_fill()
# 开始填充
turtle.left(140)
turtle.forward(224)
LittleHeart()
turtle.left(120)
LittleHeart()
turtle.forward(224)
turtle.end_fill()
turtle.pensize(5)
turtle.up()
turtle.hideturtle()
turtle.goto(0,0)
turtle.showturtle()
turtle.color('#CD5C5C','pink')
turtle.write(love,font=('gungsuh',30,),align="center")
turtle.up()
turtle.hideturtle()
if me !='':
turtle.color('black', 'pink')
time.sleep(2)
turtle.goto(180,-180)
turtle.showturtle()
turtle.write(me, font=(20,), align="center", move=True)
window=turtle.Screen()
window.exitonclick()