残奥马上要开始了,今天我们用Python turtle库绘制一个冬奥吉祥物“雪容融”吧。
废话不多说,直接上代码(核心代码):
# 头部圆圈
turtle.penup()
turtle.goto(-145, 135)
turtle.pensize(10)
turtle.pencolor("#BB3529")
turtle.fillcolor("#DA2D20")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(45)
turtle.circle(-150, 45)
turtle.forward(80)
turtle.circle(-150, 180)
turtle.forward(80)
turtle.circle(-150, 135)
turtle.end_fill()
#花纹
turtle.fillcolor("#FF9300")
turtle.begin_fill()
turtle.pensize(5)
turtle.setheading(15)
turtle.circle(-600, 28)
turtle.pencolor("#FF9300")
turtle.right(30)
turtle.circle(-150, -35)
turtle.setheading(180)
turtle.forward(100)
turtle.circle(150, 42)
turtle.end_fill()
turtle.pencolor("#DA2D20")
turtle.penup()
turtle.goto(-100, 160)
turtle.fillcolor("#DA2D20")
turtle.begin_fill()
turtle.pendown()
turtle.circle(4, 360)
turtle.end_fill()
turtle.penup()
turtle.goto(-40, 169)
turtle.fillcolor("#DA2D20")
turtle.begin_fill()
turtle.pendown()
turtle.circle(4, 360)
turtle.end_fill()
turtle.penup()
turtle.goto(20, 169)
turtle.fillcolor("#DA2D20")
turtle.begin_fill()
turtle.pendown()
turtle.circle(4, 360)
turtle.end_fill()
turtle.penup()
turtle.goto(80, 163)
turtle.fillcolor("#DA2D20")
turtle.begin_fill()
turtle.pendown()
turtle.circle(4, 360)
turtle.end_fill()
运行效果和完整代码请点击此处《使用Python Turtle绘制雪容融》前往好学好教在线Python编程平台,可以直接在网页上运行Python代码。