使用Python Turtle画一个小人发射爱心

最近刚开始学Python Turtle,尝试着画了一个发射爱心的小人,这是效果图:
在这里插入图片描述
以下是代码段:

import turtle as t
#画人的脑袋和躯干
t.speed(0)
t.penup()
t.goto(-100,100)
t.pendown()
t.pensize(3)
t.circle(50)
t.right(90)
t.forward(100)
t.right(45)
t.forward(70)
t.backward(70)
t.left(90)
t.forward(70)

#画人的小手
t.penup()
t.goto(-100,60)
t.pendown()
t.left(45)
t.forward(50)
t.right(45)
t.forward(45)
t.backward(45)
t.left(90)
t.forward(45)

#左眼
t.penup()
t.goto(-120,160)
t.pendown()
t.color('black')
t.begin_fill()
t.circle(5)
t.end_fill()

#右眼
t.penup()
t.goto(-80,160)
t.pendown()
t.color('black')
t.begin_fill()
t.circle(5)
t.end_fill()

#嘴
t.penup()
t.goto(-120,125)
t.pendown()
t.right(85)
t.circle(30,90)

#画心
t.penup()
t.goto(90,95)
t.pendown()
t.left(20)
t.color("red")
t.begin_fill()
t.circle(-35,210)
t.forward(65)
t.right(80)
t.forward(65)
t.circle(-35,210)
t.end_fill()
t.hideturtle()
t.done()

猜你喜欢

转载自blog.csdn.net/m0_57206390/article/details/124208259