Python用最简单的代码画出一箭穿心

import turtle

def curvemove(): # 定义画圆的函数
    for i in range(100):
        turtle.right(2)
        turtle.forward(2)
        turtle.speed(8)
turtle.color("red","pink")
turtle.pensize(3)
# turtle.hideturtle() # 隐藏画笔的形状
turtle.speed(5)
turtle.begin_fill() # 开始填充

# 左侧
turtle.left(140)
turtle.forward(111.65)
curvemove()
# 右侧
turtle.left(120)
curvemove()
turtle.forward(111.65)
turtle.end_fill()

# 第二个爱心
turtle.color("pink","red")
turtle.begin_fill()
turtle.penup()
turtle.goto(60,0)
turtle.pendown()
turtle.right(80)
turtle.forward(111.65)
curvemove()

turtle.left(120)
curvemove()
turtle.forward(111.65)
turtle.end_fill()

# 画箭
turtle.color('red', 'red')
turtle.begin_fill()
turtle.hideturtle()
turtle.penup()
turtle.goto(-150, 20)
turtle.pendown()
turtle.pensize(5)
turtle.right(80)
turtle.forward(15)

turtle.right(120)
turtle.forward(40)

turtle.right(60)
turtle.forward(14)

turtle.left(60)
turtle.forward(375)

turtle.left(90)
turtle.forward(10)

turtle.right(110)
turtle.forward(30)

turtle.right(140)
turtle.forward(30)

turtle.right(110)
turtle.forward(10)

turtle.left(90)
turtle.forward(375)

turtle.left(60)
turtle.forward(14)

turtle.right(60)
turtle.forward(40)

turtle.right(120)
turtle.forward(15)

turtle.end_fill()

turtle.penup()
turtle.goto(10.5,85)
turtle.color("purple")
turtle.write("L O V E",font=("黑体",20,"normal"))
turtle.done()

 

 实现结果如下:

Python用最简单的代码画出一箭穿心_第1张图片

你可能感兴趣的:(Python)