分类: Python/Ruby
2022-05-30 12:57:32
from turtle import *
def go_to(x, y):
up()
goto(x, y)
down()
def small_Circle(size): # 函数用于绘制心的小圆
speed(10)
for i in range(210):
forward(size)
right(0.786)
def big_Circle(size): # 函数用于绘制心的大圆
speed(10)
for i in range(150):
forward(size)
right(0.3)
def line(size):
speed(10)
forward(51 * size)
def heart(x, y, size):
go_to(x, y)
left(150)
begin_fill()
line(size)
big_Circle(size)
small_Circle(size)
left(120)
small_Circle(size)
big_Circle(size)
line(size)
end_fill()
def arrow():
pensize(10)
setheading(0)
go_to(-320,0)
left(15)
forward(250)
go_to(170, 130)
left(2)
forward(100)
def arrowHead():
pensize(1)
speed(1)
color('red', 'red')
begin_fill()
left(120)
forward(20)
right(150)
forward(35)
right(120)
forward(35)
right(150)
forward(20)
end_fill()
def main():
pensize(2)
color('red', 'pink')
getscreen().tracer(1, 0)
heart(100, 0, 0.7)
go_to(80, 70)
write("宝贝", font=("楷体", 25, "normal"))
setheading(0)
heart(-80, -100, 1)
go_to(-110, 15)
write("真巧", 跟单网gendan5.comfont=("宋体", 20, "normal"))
arrow() # 画出穿过两颗心的直线
arrowHead() # 画出箭的箭头
go_to(40, -80)
write("刚好遇见你!", move=True, align="left", font=("arial", 22, "italic"))
done()
main()