import turtle # 定义一个画心形的函数 def heart(): turtle.color("red", "pink") turtle.begin_fill() turtle.left(140) turtle.forward(170) turtle.circle(-70, 180) turtle.setheading(60) turtle.circle(-70, 180) turtle.forward(170) turtle.end_fill() # 调用画心形的函数 heart() # 让心形停留在屏幕上 turtle.exitonclick()