这段时间,随着北京冬奥会的开幕,吉祥物“冰墩墩”可谓是超级火,多少人排队都买不到,既然买不到,那就给大家出一个Python版冰墩墩。

为了帮助大家早日实现“一户一墩”,八百里加急,给大家出这个

Python版“冰墩墩”

话不多说,先上效果图

python绘制梅塔特隆立方体(利用python教你绘制冬奥吉祥物)(1)

说实话,这个没什么技术含量,就是硬写,不断调整曲线细节,用python自带的turtle库来画图。

python绘制梅塔特隆立方体(利用python教你绘制冬奥吉祥物)(2)

由于代码比较长!给大家展示主要核心代码!上教程

左手

turtle.penup()turtle.goto(177, 112)turtle.pencolor("lightgray")turtle.pensize(3)turtle.fillcolor("white")turtle.begin_fill()turtle.pendown()turtle.setheading(80)turtle.circle(-45, 200)turtle.circle(-300, 23)

左手内

turtle.penup()turtle.goto(182, 95)turtle.pencolor("black")turtle.pensize(1)turtle.fillcolor("black")turtle.begin_fill()turtle.setheading(95)turtle.pendown()turtle.circle(-37, 160)turtle.circle(-20, 50)turtle.circle(-200, 30)

头顶

turtle.penup()turtle.goto(-73, 230)turtle.pencolor("lightgray")turtle.pensize(3)turtle.fillcolor("white")turtle.begin_fill()turtle.pendown()turtle.setheading(20)turtle.circle(-250, 35)

左耳

turtle.setheading(50)turtle.circle(-42, 180)

左侧

turtle.setheading(-50)turtle.circle(-190, 30)turtle.circle(-320, 45)

左腿

turtle.circle(120, 30)turtle.circle(200, 12)turtle.circle(-18, 85)turtle.circle(-180, 23)turtle.circle(-20, 110)turtle.circle(15, 115)turtle.circle(100, 12)

右腿

turtle.circle(15, 120)turtle.circle(-15, 110)turtle.circle(-150, 30)turtle.circle(-15, 70)turtle.circle(-150, 10)turtle.circle(200, 35)turtle.circle(-150, 20)

右手

turtle.setheading(-120)turtle.circle(50, 30)turtle.circle(-35, 200)turtle.circle(-300, 23)

右侧turtle.setheading(86)turtle.circle(-300, 26)

右耳turtle.setheading(122)turtle.circle(-53, 160)turtle.end_fill()

,