Python代码画路飞
时间: 2023-03-26 19:01:04 浏览: 873
可以使用 Python 的 turtle 模块来画路飞,具体代码可以参考以下示例:
import turtle
# 设置画笔
pen = turtle.Turtle()
pen.speed(10)
pen.pensize(5)
# 画路飞的帽子
pen.fillcolor("red")
pen.begin_fill()
pen.circle(100, 180)
pen.goto(, )
pen.end_fill()
# 画路飞的脸
pen.fillcolor("yellow")
pen.begin_fill()
pen.circle(100)
pen.end_fill()
# 画路飞的眼睛
pen.penup()
pen.goto(-40, 120)
pen.pendown()
pen.fillcolor("white")
pen.begin_fill()
pen.circle(20)
pen.end_fill()
pen.penup()
pen.goto(-30, 130)
pen.pendown()
pen.fillcolor("black")
pen.begin_fill()
pen.circle(10)
pen.end_fill()
pen.penup()
pen.goto(40, 120)
pen.pendown()
pen.fillcolor("white")
pen.begin_fill()
pen.circle(20)
pen.end_fill()
pen.penup()
pen.goto(30, 130)
pen.pendown()
pen.fillcolor("black")
pen.begin_fill()
pen.circle(10)
pen.end_fill()
# 画路飞的嘴巴
pen.penup()
pen.goto(-60, 80)
pen.pendown()
pen.right(45)
pen.circle(80, 90)
# 画路飞的胡须
pen.penup()
pen.goto(-80, 60)
pen.pendown()
pen.right(45)
pen.forward(80)
pen.penup()
pen.goto(-80, 40)
pen.pendown()
pen.right(90)
pen.forward(80)
pen.penup()
pen.goto(-80, 20)
pen.pendown()
pen.right(45)
pen.forward(80)
pen.penup()
pen.goto(80, 60)
pen.pendown()
pen.left(90)
pen.forward(80)
pen.penup()
pen.goto(80, 40)
pen.pendown()
pen.left(45)
pen.forward(80)
pen.penup()
pen.goto(80, 20)
pen.pendown()
pen.left(90)
pen.forward(80)
# 画路飞的眉毛
pen.penup()
pen.goto(-60, 160)
pen.pendown()
pen.right(45)
pen.forward(40)
pen.penup()
pen.goto(60, 160)
pen.pendown()
pen.left(90)
pen.forward(40)
# 完成画图
turtle.done()
阅读全文