AI悦创

V1

2022/02/09阅读:2397主题:橙心

冰墩墩买不到?教你用 Python 画一个~

你好,我是悦创。

这两天,随着北京冬奥会的开幕,吉祥物“冰墩墩”可是火出了圈,多少人排长队都买不到。据说甚至有人把价格炒到了几千元。

这个其实还好,我自己本身原本要在自己的新弄的书房添置一些物件,无意间就想不然买个冬奥会的吉祥物吧。

然后,就去淘宝看,结果抢了三次没强到,有被恶心到,连续几天都预售何必饥饿营销。无语子,买个吉祥物还有数量限制,限制就限制能不能别连续几天的饥饿营销!

为了帮助大家早日实现“一户一墩”,AI悦创,连夜加班,肝出了这个:

Python 版冰墩墩

在这里插入图片描述
在这里插入图片描述

AI悦创·推出辅导班啦,包括「Python 语言辅导班、C++辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发」,全部都是一对一教学:一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。QQ、微信在线,随时响应!V:Jiabcdefh

说实话,这个没什么技术含量,就是硬“”,不断调整曲线细节。

用的是 Python 自带的 turtle 库。

说个用 turtle 画图的小技巧:你可以通过:

turtle.bgpic(r'bg.png')

接下来,我就放出完整代码,只要你安装了 Python 环境,直接复制代码运行即可。

import turtle

turtle.title('PythonBingDwenDwen(公众号:AI悦创),编程私教')

turtle.speed(1000)  # 速度

# 左手
turtle.penup()
turtle.goto(177112)
turtle.pencolor("lightgray")
turtle.pensize(3)
turtle.fillcolor("white")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(80)
turtle.circle(-45200)
turtle.circle(-30023)
turtle.end_fill()

# 左手内
turtle.penup()
turtle.goto(18295)
turtle.pencolor("black")
turtle.pensize(1)
turtle.fillcolor("black")
turtle.begin_fill()
turtle.setheading(95)
turtle.pendown()
turtle.circle(-37160)
turtle.circle(-2050)
turtle.circle(-20030)
turtle.end_fill()
# 轮廓
# 头顶
turtle.penup()
turtle.goto(-73230)
turtle.pencolor("lightgray")
turtle.pensize(3)
turtle.fillcolor("white")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(20)
turtle.circle(-25035)
# 左耳
turtle.setheading(50)
turtle.circle(-42180)
# 左侧
turtle.setheading(-50)
turtle.circle(-19030)
turtle.circle(-32045)
# 左腿
turtle.circle(12030)
turtle.circle(20012)
turtle.circle(-1885)
turtle.circle(-18023)
turtle.circle(-20110)
turtle.circle(15115)
turtle.circle(10012)
# 右腿
turtle.circle(15120)
turtle.circle(-15110)
turtle.circle(-15030)
turtle.circle(-1570)
turtle.circle(-15010)
turtle.circle(20035)
turtle.circle(-15020)
# 右手
turtle.setheading(-120)
turtle.circle(5030)
turtle.circle(-35200)
turtle.circle(-30023)
# 右侧
turtle.setheading(86)
turtle.circle(-30026)
# 右耳
turtle.setheading(122)
turtle.circle(-53160)
turtle.end_fill()

# 右耳内
turtle.penup()
turtle.goto(-130180)
turtle.pencolor("black")
turtle.pensize(1)
turtle.fillcolor("black")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(120)
turtle.circle(-28160)
turtle.setheading(210)
turtle.circle(15020)
turtle.end_fill()

# 左耳内
turtle.penup()
turtle.goto(90230)
turtle.setheading(40)
turtle.begin_fill()
turtle.pendown()
turtle.circle(-30170)
turtle.setheading(125)
turtle.circle(15023)
turtle.end_fill()

# 右手内
turtle.penup()
turtle.goto(-180-55)
turtle.fillcolor("black")
turtle.begin_fill()
turtle.setheading(-120)
turtle.pendown()
turtle.circle(5030)
turtle.circle(-27200)
turtle.circle(-30020)
turtle.setheading(-90)
turtle.circle(30014)
turtle.end_fill()

# 左腿内
turtle.penup()
turtle.goto(108-168)
turtle.fillcolor("black")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(-115)
turtle.circle(11015)
turtle.circle(20010)
turtle.circle(-1880)
turtle.circle(-18013)
turtle.circle(-2090)
turtle.circle(1560)
turtle.setheading(42)
turtle.circle(-20029)
turtle.end_fill()
# 右腿内
turtle.penup()
turtle.goto(-38-210)
turtle.fillcolor("black")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(-155)
turtle.circle(15100)
turtle.circle(-10110)
turtle.circle(-10030)
turtle.circle(-1565)
turtle.circle(-10010)
turtle.circle(20015)
turtle.setheading(-14)
turtle.circle(-20027)
turtle.end_fill()

# 右眼
# 眼圈
turtle.penup()
turtle.goto(-64120)
turtle.begin_fill()
turtle.pendown()
turtle.setheading(40)
turtle.circle(-35152)
turtle.circle(-10050)
turtle.circle(-35130)
turtle.circle(-10050)
turtle.end_fill()
# 眼珠
turtle.penup()
turtle.goto(-4755)
turtle.fillcolor("white")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(0)
turtle.circle(25360)
turtle.end_fill()
turtle.penup()
turtle.goto(-4562)
turtle.pencolor("darkslategray")
turtle.fillcolor("darkslategray")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(0)
turtle.circle(19360)
turtle.end_fill()
turtle.penup()
turtle.goto(-4568)
turtle.fillcolor("black")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(0)
turtle.circle(10360)
turtle.end_fill()
turtle.penup()
turtle.goto(-4786)
turtle.pencolor("white")
turtle.fillcolor("white")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(0)
turtle.circle(5360)
turtle.end_fill()

# 左眼
# 眼圈
turtle.penup()
turtle.goto(5182)
turtle.fillcolor("black")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(120)
turtle.circle(-32152)
turtle.circle(-10055)
turtle.circle(-25120)
turtle.circle(-12045)
turtle.end_fill()
# 眼珠
turtle.penup()
turtle.goto(7960)
turtle.fillcolor("white")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(0)
turtle.circle(24360)
turtle.end_fill()
turtle.penup()
turtle.goto(7964)
turtle.pencolor("darkslategray")
turtle.fillcolor("darkslategray")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(0)
turtle.circle(19360)
turtle.end_fill()
turtle.penup()
turtle.goto(7970)
turtle.fillcolor("black")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(0)
turtle.circle(10360)
turtle.end_fill()
turtle.penup()
turtle.goto(7988)
turtle.pencolor("white")
turtle.fillcolor("white")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(0)
turtle.circle(5360)
turtle.end_fill()

# 鼻子
turtle.penup()
turtle.goto(3780)
turtle.fillcolor("black")
turtle.begin_fill()
turtle.pendown()
turtle.circle(-8130)
turtle.circle(-22100)
turtle.circle(-8130)
turtle.end_fill()

# 嘴
turtle.penup()
turtle.goto(-1548)
turtle.setheading(-36)
turtle.begin_fill()
turtle.pendown()
turtle.circle(6070)
turtle.setheading(-132)
turtle.circle(-45100)
turtle.end_fill()

# 彩虹圈
turtle.penup()
turtle.goto(-135120)
turtle.pensize(5)
turtle.pencolor("cyan")
turtle.pendown()
turtle.setheading(60)
turtle.circle(-165150)
turtle.circle(-13078)
turtle.circle(-25030)
turtle.circle(-138105)
turtle.penup()
turtle.goto(-131116)
turtle.pencolor("slateblue")
turtle.pendown()
turtle.setheading(60)
turtle.circle(-160144)
turtle.circle(-12078)
turtle.circle(-24230)
turtle.circle(-135105)
turtle.penup()
turtle.goto(-127112)
turtle.pencolor("orangered")
turtle.pendown()
turtle.setheading(60)
turtle.circle(-155136)
turtle.circle(-11686)
turtle.circle(-22030)
turtle.circle(-134103)
turtle.penup()
turtle.goto(-123108)
turtle.pencolor("gold")
turtle.pendown()
turtle.setheading(60)
turtle.circle(-150136)
turtle.circle(-10486)
turtle.circle(-22030)
turtle.circle(-126102)
turtle.penup()
turtle.goto(-120104)
turtle.pencolor("greenyellow")
turtle.pendown()
turtle.setheading(60)
turtle.circle(-145136)
turtle.circle(-9083)
turtle.circle(-22030)
turtle.circle(-120100)
turtle.penup()

# 爱心
turtle.penup()
turtle.goto(220115)
turtle.pencolor("brown")
turtle.pensize(1)
turtle.fillcolor("brown")
turtle.begin_fill()
turtle.pendown()
turtle.setheading(36)
turtle.circle(-8180)
turtle.circle(-6024)
turtle.setheading(110)
turtle.circle(-6024)
turtle.circle(-8180)
turtle.end_fill()

# 五环
turtle.penup()
turtle.goto(-5-170)
turtle.pendown()
turtle.pencolor("blue")
turtle.circle(6)
turtle.penup()
turtle.goto(10-170)
turtle.pendown()
turtle.pencolor("black")
turtle.circle(6)
turtle.penup()
turtle.goto(25-170)
turtle.pendown()
turtle.pencolor("brown")
turtle.circle(6)
turtle.penup()
turtle.goto(2-175)
turtle.pendown()
turtle.pencolor("lightgoldenrod")
turtle.circle(6)
turtle.penup()
turtle.goto(16-175)
turtle.pendown()
turtle.pencolor("green")
turtle.circle(6)
turtle.penup()

turtle.pencolor("black")
turtle.goto(-16-160)
turtle.write("BEIJING 2022", font=('Arial'10'bold italic'))
turtle.hideturtle()

turtle.done()

AI悦创·推出辅导班啦,包括「Python 语言辅导班、C++辅导班、算法/数据结构辅导班、少儿编程、pygame 游戏开发」,全部都是一对一教学:一对一辅导 + 一对一答疑 + 布置作业 + 项目实践等。QQ、微信在线,随时响应!V:Jiabcdefh

在这里插入图片描述
在这里插入图片描述

分类:

后端

标签:

Python

作者介绍

AI悦创
V1