1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > python杂学之用turtle画熊二(附代码)

python杂学之用turtle画熊二(附代码)

时间:2021-05-14 14:09:18

相关推荐

python杂学之用turtle画熊二(附代码)

先放一张想要画的图

再一张 过程图

到这里好像还可以,还是蛮可爱

接着,加上了眼睛高光,有点可怜兮兮的味道了

加上嘴巴以后

.......

“你看我开心吗”

import turtle as t# turtle.pos()# home() #以当前海龟位置为坐标原点t.pensize(4) # 画笔线条宽度t.colormode(255) # 画笔颜色模式t.screensize(800, 6000, "#F0F0F0") # 画布宽、高、背景颜色t.speed(9) # 画笔移动速度# 变形的脑袋t.pu() # 提起画笔,不绘图t.goto(0, 0) # 移动至指定坐标t.pd() # 画笔移动时绘制图形t.seth(30) # 设置画笔角度t.color(204, 147, 86)t.begin_fill()t.circle(100, 100)t.circle(400, 20)t.circle(100, 100)t.circle(400, 20)t.circle(100, 100)t.end_fill()# 耳朵t.pu()t.goto(-20, 200)t.pd()t.seth(30)t.color(204, 147, 86)t.begin_fill()t.circle(50)t.end_fill()t.pu()t.goto(-200, 150)t.pd()t.seth(30)t.color(204, 147, 86)t.begin_fill()t.circle(50)t.end_fill()# 身子t.pu()t.goto(-180, -20)t.pd()t.seth(-130)t.color(204, 147, 86)t.begin_fill()t.circle(500, 50)t.seth(0)t.fd(500)t.seth(100)t.circle(1000, 30)t.end_fill()# 右胳膊t.pu()t.goto(-10, 40)t.pd()t.color(204, 147, 86)t.begin_fill()t.seth(-30)t.circle(-500, 30)t.seth(-95)t.circle(-300, 50)t.end_fill()# 胳膊细线t.pu()t.goto(70, -100)t.pd()t.color(66, 25, 5)t.begin_fill()t.seth(-50)t.circle(-500, 30)t.end_fill()t.pu()t.goto(-200, -100)t.pd()t.color(66, 25, 5)t.begin_fill()t.seth(240)t.circle(500, 30)t.end_fill()# 白色肚子t.pu()t.goto(-60, -130)t.pd()t.seth(-130)t.color(252, 248, 200)t.begin_fill()t.seth(90)t.setheading(-90 + 270)a = 5for i in range(120):if 0 <= i < 30 or 60 <= i < 90:a += 0.08t.lt(3) # 向左转3度t.fd(a) # 向前走a的步长else:a -= 0.08t.lt(3)t.fd(a)t.end_fill()# 眼睛t.pu()t.color(5, 7, 4)t.goto(-180, 80)t.pd()t.begin_fill()t.seth(90)t.setheading(100 + 270)a = 0.3for i in range(120):if 0 <= i < 30 or 60 <= i < 90:a += 0.08t.lt(3) # 向左转3度t.fd(a) # 向前走a的步长else:a -= 0.08t.lt(3)t.fd(a)t.end_fill()t.pu()t.goto(-50, 120)t.pd()t.begin_fill()t.seth(90)t.setheading(120 + 270)a = 0.3for i in range(120):if 0 <= i < 30 or 60 <= i < 90:a += 0.08t.lt(3) # 向左转3度t.fd(a) # 向前走a的步长else:a -= 0.08t.lt(3)t.fd(a)t.end_fill()# 眼睛高光t.pu()t.color(252, 248, 200)t.goto(-185, 115)t.pd()t.begin_fill()t.seth(90)t.circle(5)t.end_fill()t.pu()t.color(252, 248, 200)t.goto(-60, 155)t.pd()t.begin_fill()t.seth(90)t.circle(5)t.end_fill()# 嘴巴t.pu()t.goto(-230, 40)t.pd()t.color(168, 127, 97)t.begin_fill()t.seth(-15)t.circle(200, 80)t.seth(-80)t.circle(-200, 30)t.seth(230)t.circle(-200, 50)t.seth(150)t.circle(-200, 28)t.end_fill()# 嘴巴细线t.pu()t.goto(-10, 90)t.pd()t.color(217, 157, 146)t.seth(-120)t.circle(-170, 70)t.mainloop()

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。