PYTHON画冰墩墩代码(python画冰墩墩代码教程)

更新时间:2023-03-02 12:06:26 阅读: 评论:0

奥运会也结束了,但是大家预定的冰墩墩想来还没到的是吧?哈哈,别急,在这里送你一只冰墩墩并送给其他的小伙伴。

过程需要利用到一点点东西,你不需要完全理解,直接按照步骤即可实现,加油哦~

为了尽快让你实现,都是按照最简单的方法实现。

安装python:百度搜索“anaconda“,下载安装好就行。

打开开始菜单,运行,输入cmd。

输入python,出现了下图类似的界面,说明已经成功了。关掉。

在你的D盘新建记事本如bdd.txt。输入下面的代码:

import turtleturtle.title('Python(冰墩墩)')turtle.speed(8) # 可以自己调节速度# 左手turtle.penup()turtle.goto(177, 112)turtle.pencolor("lightgray")turtle.pensize(3)turtle.fillcolor("white")turtle.begin_fill()turtle.pendown()turtle.theading(80)turtle.circle(-45, 200)turtle.circle(-300, 23)turtle.end_fill()# 左手内turtle.penup()turtle.goto(182, 95)turtle.pencolor("black")turtle.pensize(1)turtle.fillcolor("black")turtle.begin_fill()turtle.theading(95)turtle.pendown()turtle.circle(-37, 160)turtle.circle(-20, 50)turtle.circle(-200, 30)turtle.end_fill()# 轮廓# 头顶turtle.penup()turtle.goto(-73, 230)turtle.pencolor("lightgray")turtle.pensize(3)turtle.fillcolor("white")turtle.begin_fill()turtle.pendown()turtle.theading(20)turtle.circle(-250, 35)# 左耳turtle.theading(50)turtle.circle(-42, 180)# 左侧turtle.theading(-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.theading(-120)turtle.circle(50, 30)turtle.circle(-35, 200)turtle.circle(-300, 23)# 右侧turtle.theading(86)turtle.circle(-300, 26)# 右耳turtle.theading(122)turtle.circle(-53, 160)turtle.end_fill()# 右耳内turtle.penup()turtle.goto(-130, 180)turtle.pencolor("black")turtle.pensize(1)turtle.fillcolor("black")turtle.begin_fill()turtle.pendown()turtle.theading(120)turtle.circle(-28, 160)turtle.theading(210)turtle.circle(150, 20)turtle.end_fill()# 左耳内turtle.penup()turtle.goto(90, 230)turtle.theading(40)turtle.begin_fill()turtle.pendown()turtle.circle(-30, 170)turtle.theading(125)turtle.circle(150, 23)turtle.end_fill()# 右手内turtle.penup()turtle.goto(-180, -55)turtle.fillcolor("black")turtle.begin_fill()turtle.theading(-120)turtle.pendown()turtle.circle(50, 30)turtle.circle(-27, 200)turtle.circle(-300, 20)turtle.theading(-90)turtle.circle(300, 14)turtle.end_fill()# 左腿内turtle.penup()turtle.goto(108, -168)turtle.fillcolor("black")turtle.begin_fill()turtle.pendown()turtle.theading(-115)turtle.circle(110, 15)turtle.circle(200, 10)turtle.circle(-18, 80)turtle.circle(-180, 13)turtle.circle(-20, 90)turtle.circle(15, 60)turtle.theading(42)turtle.circle(-200, 29)turtle.end_fill()# 右腿内turtle.penup()turtle.goto(-38, -210)turtle.fillcolor("black")turtle.begin_fill()turtle.pendown()turtle.theading(-155)turtle.circle(15, 100)turtle.circle(-10, 110)turtle.circle(-100, 30)turtle.circle(-15, 65)turtle.circle(-100, 10)turtle.circle(200, 15)turtle.theading(-14)turtle.circle(-200, 27)turtle.end_fill()# 右眼# 眼圈turtle.penup()turtle.goto(-64, 120)turtle.begin_fill()turtle.pendown()turtle.theading(40)turtle.circle(-35, 152)turtle.circle(-100, 50)turtle.circle(-35, 130)turtle.circle(-100, 50)turtle.end_fill()# 眼珠turtle.penup()turtle.goto(-47, 55)turtle.fillcolor("white")turtle.begin_fill()turtle.pendown()turtle.theading(0)turtle.circle(25, 360)turtle.end_fill()turtle.penup()turtle.goto(-45, 62)turtle.pencolor("darkslategray")turtle.fillcolor("darkslategray")turtle.begin_fill()turtle.pendown()turtle.theading(0)turtle.circle(19, 360)turtle.end_fill()turtle.penup()turtle.goto(-45, 68)turtle.fillcolor("black")turtle.begin_fill()turtle.pendown()turtle.theading(0)turtle.circle(10, 360)turtle.end_fill()turtle.penup()turtle.goto(-47, 86)turtle.pencolor("white")turtle.fillcolor("white")turtle.begin_fill()turtle.pendown()turtle.theading(0)turtle.circle(5, 360)turtle.end_fill()# 左眼# 眼圈turtle.penup()turtle.goto(51, 82)turtle.fillcolor("black")turtle.begin_fill()turtle.pendown()turtle.theading(120)turtle.circle(-32, 152)turtle.circle(-100, 55)turtle.circle(-25, 120)turtle.circle(-120, 45)turtle.end_fill()# 眼珠turtle.penup()turtle.goto(79, 60)turtle.fillcolor("white")turtle.begin_fill()turtle.pendown()turtle.theading(0)turtle.circle(24, 360)turtle.end_fill()turtle.penup()turtle.goto(79, 64)turtle.pencolor("darkslategray")turtle.fillcolor("darkslategray")turtle.begin_fill()turtle.pendown()turtle.theading(0)turtle.circle(19, 360)turtle.end_fill()turtle.penup()turtle.goto(79, 70)turtle.fillcolor("black")turtle.begin_fill()turtle.pendown()turtle.theading(0)turtle.circle(10, 360)turtle.end_fill()turtle.penup()turtle.goto(79, 88)turtle.pencolor("white")turtle.fillcolor("white")turtle.begin_fill()turtle.pendown()turtle.theading(0)turtle.circle(5, 360)turtle.end_fill()# 鼻子turtle.penup()turtle.goto(37, 80)turtle.fillcolor("black")turtle.begin_fill()turtle.pendown()turtle.circle(-8, 130)turtle.circle(-22, 100)turtle.circle(-8, 130)turtle.end_fill()# 嘴turtle.penup()turtle.goto(-15, 48)turtle.theading(-36)turtle.begin_fill()turtle.pendown()turtle.circle(60, 70)turtle.theading(-132)turtle.circle(-45, 100)turtle.end_fill()# 彩虹圈turtle.penup()turtle.goto(-135, 120)turtle.pensize(5)turtle.pencolor("cyan")turtle.pendown()turtle.theading(60)turtle.circle(-165, 150)turtle.circle(-130, 78)turtle.circle(-250, 30)turtle.circle(-138, 105)turtle.penup()turtle.goto(-131, 116)turtle.pencolor("slateblue")turtle.pendown()turtle.theading(60)turtle.circle(-160, 144)turtle.circle(-120, 78)turtle.circle(-242, 30)turtle.circle(-135, 105)turtle.penup()turtle.goto(-127, 112)turtle.pencolor("orangered")turtle.pendown()turtle.theading(60)turtle.circle(-155, 136)turtle.circle(-116, 86)turtle.circle(-220, 30)turtle.circle(-134, 103)turtle.penup()turtle.goto(-123, 108)turtle.pencolor("gold")turtle.pendown()turtle.theading(60)turtle.circle(-150, 136)turtle.circle(-104, 86)turtle.circle(-220, 30)turtle.circle(-126, 102)turtle.penup()turtle.goto(-120, 104)turtle.pencolor("greenyellow")turtle.pendown()turtle.theading(60)turtle.circle(-145, 136)turtle.circle(-90, 83)turtle.circle(-220, 30)turtle.circle(-120, 100)turtle.penup()# 爱心turtle.penup()turtle.goto(220, 115)turtle.pencolor("brown")turtle.pensize(1)turtle.fillcolor("brown")turtle.begin_fill()turtle.pendown()turtle.theading(36)turtle.circle(-8, 180)turtle.circle(-60, 24)turtle.theading(110)turtle.circle(-60, 24)turtle.circle(-8, 180)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()

好了,代码结束,保存好,修改刚刚新建的文件后缀.txt改成.py。

重新打开开始菜单,找到运行,输入cmd。输入D:

输入python bdd.py

你就能看到一只冰墩墩啦~~~

但是怎么发给你的小伙伴呢?别急,继续。

重新打开开始菜单,找到运行,输入cmd。输入以下内容。

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyinstaller

等待安装完毕后,输入:pyinstaller -F bdd.py

你就能看到在你的D盘有一个dist的文件夹,里面的exe文件就可以发送给你的小伙伴啦~

本文发布于:2023-02-28 21:08:00,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/zhishi/a/1677729986100597.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:PYTHON画冰墩墩代码(python画冰墩墩代码教程).doc

本文 PDF 下载地址:PYTHON画冰墩墩代码(python画冰墩墩代码教程).pdf

标签:代码   教程   PYTHON   画冰墩墩   python
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 实用文体写作网旗下知识大全大全栏目是一个全百科类宝库! 优秀范文|法律文书|专利查询|