python画熊猫代码_用Python Turtle 画可爱的熊猫
import turtle as t
# 设置初始画布和画笔
t.setup(width=1450, height=1450, startx=0, starty=0)
t.speed(0)
t.rt(-120)
t.up()
t.pensize(6)
t.goto(180, 150)
t.bgcolor('white')
t.title("My Panda")
t.down()
t.color('black')
#头轮廓
t.circle(190, 100)
t.fd(20)
for i in range(260):
t.fd(1)
t.lt(0.5)
for i in range(8):
t.fd(19)
t.lt(1)
for i in range(260):
t.fd(1)
t.lt(0.5)
t.up()
#身子轮廓
t.goto(-70, -16)
t.setheading(245)
t.down()
for i in range(35):
t.fd(1.5)
t.lt(0.5)
for i in range(5):
t.fd(1.5)
t.lt(0.0125)
for i in range(9):
t.fd(0.75)
t.lt(1.5)
for i in range(22):
t.fd(1)
t.lt(0.3)
for i in range(20):
t.fd(1)
t.lt(3)
for i in range(180):
t.fd(1)
t.lt(0.20)
for i in range(20):
t.fd(1)
t.lt(3)
for i in range(22):
t.fd(1)
t.lt(0.3)
for i in range(9):
t.fd(0.75)
t.lt(1.5)
for i in range(5):
t.fd(1.5)
t.lt(0.0125)
for i in range(25):
t.fd(1.5)
t.lt(0.5)
t.up()
#脚
#右脚
t.goto(-65, -119)
t.down()
t.begin_fill()
t.color('black')
t.setheading(280)
t.circle(30, 135)
t.end_fill()
t.up()
#左脚
t.goto(50, -129)
t.down()
t.begin_fill()
t.color('black')
t.setheading(305)
t.circle(30, 135)
t.end_fill()
t.up()
#耳朵
#左耳
t.goto(200, 118)
t.down()
t.begin_fill()
t.color('black')
t.setheading(20)
t.circle(50, 210)
t.end_fill()
t.up()
#右耳
t.goto(-70, 227)
t.down()
t.begin_fill()
t.color('black')
t.setheading(103)
t.circle(50, 230)
t.end_fill()
t.up()
t.goto(117, -40)
t.setheading(25)
t.down()
#手
#左手
t.begin_fill()
t.color('black')
for i in range(70):
t.fd(1)
t.lt(-0.5)
for i in range(160):
t.fd(0.25)
t.lt(-0.9)
for i in range(70):
t.fd(1)
t.lt(-0.65)
t.end_fill()
t.up()
#右手
t.goto(-75, -25)
t.setheading(155)
t.down()
t.begin_fill()
t.color('black')
for i in range(70):
t.fd(1)
t.lt(0.5)
for i in range(160):
t.fd(0.25)
t.lt(0.85)
for i in range(70):
t.fd(1)
t.lt(0.65)
t.end_fill()
#眼睛
#右眼
t.up()
t.goto(-45, 80)
t.begin_fill()
t.color('black')
t.down()
t.circle(25.25)
t.end_fill()
t.up()
t.goto(-50.5, 74.5)
t.begin_fill()
t.color('black')
t.down()
t.circle(26.25)
t.end_fill()
t.up()
t.goto(-43, 100)
t.begin_fill()
t.color('white')
t.down()
t.circle(5.5)
t.end_fill()
t.up()
#左眼
t.goto(100, 67)
t.begin_fill()
t.color('black')
t.down()
t.circle(25.25)
t.end_fill()
t.up()
t.goto(105.5, 63.5)
t.begin_fill()
t.color('black')
t.down()
t.circle(25.25)
t.end_fill()
t.up()
t.goto(96, 92)
t.begin_fill()
t.color('white')
t.down()
t.circle(5.5)
t.end_fill()
t.up()
#腮红
#左
t.goto(105, 40)
t.begin_fill()
t.color('tomato')
a = 0.45
t.down()
t.setheading(270)
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a+0.045
t.lt(3)
t.fd(a)
else:
a = a-0.045
t.lt(3)
t.fd(a)
t.end_fill()
t.up()
#右
t.goto(-60, 50)
t.begin_fill()
t.color('tomato')
a = 0.4
t.down()
t.setheading(90)
for i in range(120):
if 0 <= i < 30 or 60 <= i < 90:
a = a+0.04
t.lt(3)
t.fd(a)
else:
a = a-0.04
t.lt(3)
t.fd(a)
t.end_fill()
t.up()
#鼻子
t.goto(20, 75)
t.begin_fill()
t.color('black')
t.setheading(125)
t.down()
for i in range(25):
t.fd(0.75)
t.lt(-1)
for i in range(20):
t.fd(0.25)
t.lt(-4.5)
for i in range(30):
t.fd(0.75)
t.lt(-1)
for i in range(20):
t.fd(0.25)
t.lt(-4.5)
for i in range(25):
t.fd(0.75)
t.lt(-1)
for i in range(20):
t.fd(0.25)
t.lt(-4.5)
t.end_fill()
t.up()
#嘴巴
t.setheading(260)
t.goto(23, 75)
t.down()
for i in range(45):
t.fd(1)
t.lt(3)
t.up()
t.setheading(260)
t.goto(23, 75)
t.down()
for i in range(45):
t.fd(1)
t.lt(-3)
#字
t.color('red')
x = -100
t.up()
t.goto(x, 300)
t.down()
t.write('I', align='center', font=('Arial', 30, 'bold'))
t.up()
t.color('orange')
x = x + 25
t.goto(x, 300)
t.down()
t.write('l', align='center', font=('Arial', 30, 'bold'))
t.up()
x = x + 13
t.color('gold')
t.goto(x, 300)
t.down()
t.write('o', align='center', font=('Arial', 30, 'bold'))
t.up()
t.color('green')
x = x + 15
t.goto(x, 300)
t.down()
t.write('v', align='center', font=('Arial', 30, 'bold'))
t.up()
t.color('lime')
x = x + 15
t.goto(x, 300)
t.down()
t.write('e', align='center', font=('Arial', 30, 'bold'))
t.up()
t.color('blue')
x = x + 30
t.goto(x, 300)
t.down()
t.write('m', align='center', font=('Arial', 30, 'bold'))
t.up()
x = x + 20
t.color('purple')
t.goto(x, 300)
t.down()
t.write('y', align='center', font=('Arial', 30, 'bold'))
t.up()
t.color('black')
x = x + 30
t.goto(x, 300)
t.down()
t.write('P', align='center', font=('Arial', 30, 'bold'))
t.up()
t.color('grey')
x = x + 17
t.goto(x, 300)
t.down()
t.write('a', align='center', font=('Arial', 30, 'bold'))
t.up()
t.color('black')
x = x + 17
t.goto(x, 300)
t.down()
t.write('n', align='center', font=('Arial', 30, 'bold'))
t.up()
t.color('grey')
x = x + 17
t.goto(x, 300)
t.down()
t.write('d', align='center', font=('Arial', 30, 'bold'))
t.up()
t.color('black')
x = x + 17
t.goto(x, 300)
t.down()
t.write('a', align='center', font=('Arial', 30, 'bold'))
t.ht()
#结束
t.done()
python画熊猫代码_用Python Turtle 画可爱的熊猫相关推荐
- 用python画画简单代码_使用 Python Turtle 设计简单而又美丽的图形
看看本文中这些美丽的图画.正是这样的事情让我爱上了 turtle.优秀的程序员会认为turtle是"落后原始的",但我不敢苟同. 在本教程中,我将用Python为turtle编写一 ...
- 用python画路飞代码_用Python画路飞骷髅图案【附代码】
用Python代码实现这幅图的绘制,由于学艺不精,只能用直角坐标系作为参考画出来. 配色的RGB取色色块 还有重要的量角器兄弟 下面是代码 #路飞骷髅 import turtle as t #黄底帽子 ...
- 用python画路飞代码_用Python画路飞骷髅图案【附代码】-Go语言中文社区
用Python代码实现这幅图的绘制,由于学艺不精,只能用直角坐标系作为参考画出来. 配色的RGB取色色块 还有重要的量角器兄弟 下面是代码 #路飞骷髅 import turtle as t #黄底帽子 ...
- python 运行程序代码_一些python程序
<从问题到程序:用Python学编程和计算>--1.2 Python语言简介 本节书摘来自华章计算机<从问题到程序:用Python学编程和计算>一书中的第1章,第1.2节,作者 ...
- python好玩的代码_一行 Python 能实现什么丧心病狂的功能?
能够把自身代码打印出来的程序,叫做Quine.下面是python的一行quine: 有人说有分号不算一行,无分号版: 其实,如果你用程序语言的名字+quine作为关键字去搜索,你能找到各种语言实现的 ...
- python画熊猫代码_超清字符画——Python代码
字符画视频如下,可以先预览一下效果(建议进入BILIBILI全屏观看):[樱花绽放]代码敲出武汉加油(全屏观看)期待战疫成功,武大赏樱_哔哩哔哩 (゜-゜)つロ 干杯~-bilibiliwww.bi ...
- python画花朵代码_用Python绘制个花朵代码示例
用Python绘制个花朵代码示例及解析 #导入turtle模块 import turtle window=turtle.Screen() #创建一个新窗口用于绘图 babbage=turtle.Tur ...
- 如何用python画爱心代码_用 python 画爱心代码讲解
学计算机的男生发这个给我看是什么意思?www.zhihu.com 原理其实挺简单的. 代码网上也有. 最难的部分前人都告诉我们了, 心形可画. 要自己推导通过泰勒各种扭也可以. 通过肉眼扭我感觉也不 ...
- 用python画路飞代码_用python画个月亮_用python画月亮的代码 - CSDN
这幅画的画是用Python代码来实现.由于糟糕的学习技能,只能用直角坐标系作为参考.颜色匹配的RGB颜色块和重要的量角器兄弟.下面是代码#路飞枪骨进口海龟当t #黄色帽子()(0200)(-130.- ...
最新文章
- 是时候扔掉Postman了,又一个被低估的IDEA插件出来了...
- 新版Bintray-极简上传Library到JCenter
- Android 游戏开发 View框架
- 新一代互联网巨头老板,最大方谁抠门?
- fiddler显示服务器IP
- lambda java 接口_lambda – Java 8中的功能接口是什么“功能形状”?
- python 并行读取文件_python对文件进行并行计算初探(二)
- SELECT COUNT用法
- Kepserver如何连接InTouch
- java编程实现食堂饭卡刷卡_食堂饭卡管理系统设计方案报告.docx
- 阵列matlab程序,阵列信号处理的理论和应用 原书matlab 程序.rar
- css能不能实现剪切蒙版,CSS中图形剪切、遮罩功能-及使用说明
- 华盛顿邮报专访苹果CEO库克:带领苹果是个孤独的工作
- Graph Neural Controlled Differential Equations for Traffic Forecasting(AAAI2022)
- JAVA8的一些写法
- 模型编辑之BIM轻量化
- 访问网页出现503服务器,503错误,详细教您网页出现503错误怎么解决
- 服务器独享宽带和共享宽带有那些区别
- DW 6 CS6 通用破解方法
- 【即点即改】关于PHP即点即改的一些东西