(365)
(8)
(130)
(155)
(50)
(22)
分类: 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()