先贴上运行结果:
代码:
import turtle
# 鼻子
def nose(x, y):
# 提笔
turtle.penup()
# 定位
turtle.goto(x, y)
# 落笔,开始画
turtle.pendown()
# 将乌龟的方向设置为to_angle 为数字(0-东、90-北、180-西、270-南)
turtle.setheading(-30)
turtle.begin_fill() # 准备开始填充图形 8| a=0.4
a=0.4
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a + 0.08
turtle.left(3) # 向左转3度
turtle.forward(a)
else:
a = a -0.08
turtle.left(3)
turtle.forward(a)
turtle.end_fill() # 填充完成
turtle.penup()
turtle.setheading(90)
turtle.forward(25)
turtle.pendown()
turtle.pencolor(255, 155, 192)#画笔颜色
turtle.setheading(10)
turtle.begin_fill()
turtle.circle(5)
turtle.color(160, 82, 45)#返回或设置pencolor和fillcolor
turtle.end_fill()
turtle.penup()
turtle.setheading(0)
turtle.forward(20)
turtle.pendown()
turtle.pencolor(255, 155, 192)
turtle.setheading(10)
turtle.begin_fill()
turtle.