失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > python turtle 海龟绘图小恐龙(《小猪佩奇》里的)

python turtle 海龟绘图小恐龙(《小猪佩奇》里的)

时间:2023-09-18 03:36:08

相关推荐

python turtle 海龟绘图小恐龙(《小猪佩奇》里的)

python零基础 turtle库绘制《小猪佩奇》里的小恐龙

python代码

#dinosaur.pyimport turtle as t#龙身t.setup(1000,600)# 设置画布的大小t.speed(10) # 设置画笔速度为10t.pensize(5)# 设置画笔大小t.pencolor("SpringGreen4")# 设置画笔颜色t.penup() # 提笔t.goto(250,180) # 画笔前往坐标(250,180)t.begin_fill() # 准备填充t.pendown() # 落笔t.seth(120) # 画笔角度为120°t.circle(100,140) # 画一个半径为100,角度为140°的圆t.seth(-96)t.fd(120) # 向前移动120t.circle(-100,50)t.circle(-80,23)t.seth(176)t.fd(20)t.seth(180)t.circle(-315,40)t.seth(270)t.circle(50,30)t.circle(10,3)t.seth(-60)t.circle(180,40)t.circle(500,20)t.circle(750,8)t.circle(80,60)t.circle(70,30)t.fd(90)t.circle(-80,30)t.seth(10)t.fd(60)t.seth(160)t.fd(90)t.seth(22)t.fd(89)t.color("LightGreen") # 设置填充颜色#t.color('SpringGreen1')t.end_fill()# 依据轮廓填充

#龙眼t.pensize(5)t.pencolor("SpringGreen4")t.penup()t.goto(128,165)t.pendown()t.begin_fill()t.seth(0)t.circle(20,360)t.color((1,1,1)) #填充颜色为白色t.end_fill()t.penup()t.goto(128,185)t.pendown()t.seth(0)t.pensize(15)t.pencolor((0,0,0))t.circle(1,360)t.pensize(5)t.pencolor("SpringGreen4")t.penup()t.goto(177,175)t.pendown()t.begin_fill()t.seth(0)t.circle(20,360)t.color((1,1,1))t.end_fill()t.penup()t.goto(177,195)t.pendown()t.seth(0)t.pensize(15)t.pencolor((0,0,0))t.circle(1,360)

#龙爪#上爪t.penup()t.pencolor("Aquamarine4")t.goto(195,60)t.pensize(11)t.pendown()t.seth(10)t.fd(34)t.penup()t.goto(208,66)t.pendown()t.pensize(9)t.seth(45)t.fd(21)t.penup()t.goto(208,66)t.pendown()t.pensize(9)t.seth(-35)t.fd(21)#下爪t.penup()t.goto(171,20)t.pensize(11)t.pendown()t.seth(-3)t.fd(58)t.penup()t.goto(213,22)t.pendown()t.pensize(9)t.seth(35)t.fd(18)t.penup()t.goto(213,20)t.pendown()t.pensize(9)t.seth(-55)t.fd(20)t.penup()t.goto(171,20)t.pensize(14)t.pendown()t.seth(-3)t.fd(39)t.penup()t.goto(195,60)t.pensize(14)t.pendown()t.seth(10)t.fd(10)#龙脚#左脚t.penup()t.goto(71,-100)t.pensize(16)t.pendown()t.seth(-110)t.fd(40)t.penup()t.goto(55,-140)t.pendown()t.pensize(11)t.seth(-150)t.fd(28)t.penup()t.goto(55,-140)t.pendown()t.seth(-70)t.fd(23)t.penup()t.goto(55,-140)t.pendown()t.seth(-20)t.pensize(10)t.fd(23)t.seth(-40)t.pensize(11)t.fd(8)#右脚t.penup()t.goto(142,-113)t.pensize(16)t.pendown()t.seth(-80)t.fd(23)t.penup()t.goto(145,-133)t.pendown()t.pensize(11)t.seth(-120)t.fd(30)t.penup()t.goto(145,-133)t.pendown()t.pensize(11)t.seth(-70)t.fd(27)t.penup()t.goto(145,-133)t.pendown()t.pensize(10)t.seth(-27)t.fd(27)t.pensize(11)t.seth(-50)t.fd(8)

#牙齿#上牙t.penup()t.goto(240,172)t.pendown()t.color("Yellow2")t.pensize(4)t.seth(-110)t.fd(12)t.seth(120)t.fd(12)t.penup()t.goto(220,165)t.pendown()t.seth(-110)t.fd(12)t.seth(130)t.fd(12)t.penup()t.goto(200,157)t.pendown()t.seth(-110)t.fd(12)t.seth(140)t.fd(12)t.penup()t.goto(250,180)t.pensize(5)t.pencolor("SpringGreen4")t.pendown()t.seth(22)t.bk(88)#下牙t.penup()t.goto(200,140)t.pendown()t.color("Yellow2")t.pensize(4)t.seth(45)t.fd(12)t.seth(-90)t.fd(12)t.penup()t.goto(215,135)t.pendown()t.seth(45)t.fd(12)t.seth(-90)t.fd(12)t.penup()t.goto(230,130)t.pendown()t.seth(45)t.fd(12)t.seth(-90)t.fd(12)t.penup()t.goto(251,119)t.pensize(5)t.pencolor("SpringGreen4")t.pendown()t.seth(160)t.fd(89)

#龙脊t.penup()t.goto(120,220)t.pensize(5)t.pendown()t.pencolor("SeaGreen")#自头而尾 14片#1t.begin_fill()t.color('SeaGreen')t.seth(160)t.fd(40)t.seth(-60)t.fd(33)t.end_fill()#2t.begin_fill()t.color('SeaGreen')t.seth(180)t.fd(40)t.seth(-60)t.fd(33)t.end_fill()#3t.begin_fill()t.color('SeaGreen')t.seth(200)t.fd(40)t.seth(-50)t.fd(38)t.end_fill()#4t.begin_fill()t.color('SeaGreen')t.seth(205)t.fd(40)t.seth(-50)t.fd(46)t.end_fill()#5t.begin_fill()t.color('SeaGreen')t.seth(220)t.fd(40)t.seth(-50)t.fd(41.2)t.end_fill()#6t.begin_fill()t.color('SeaGreen')t.seth(190)t.fd(40)t.seth(-50)t.fd(40.8)t.end_fill()#7t.begin_fill()t.color('SeaGreen')t.seth(168)t.fd(44)t.seth(-89)t.fd(47)t.end_fill()#8t.begin_fill()t.color('SeaGreen')t.seth(138)t.fd(33)t.seth(-120)t.fd(28)t.end_fill()#9t.begin_fill()t.color('SeaGreen')t.seth(118)t.fd(32)t.seth(-120)t.fd(28)t.end_fill()#10t.begin_fill()t.color('SeaGreen')t.seth(118)t.fd(32)t.seth(-120)t.fd(30)t.end_fill()#11t.begin_fill()t.color('SeaGreen')t.seth(118)t.fd(32)t.seth(-120)t.fd(24)t.end_fill()#12t.begin_fill()t.color('SeaGreen')t.seth(118)t.fd(32)t.seth(-120)t.fd(24)t.end_fill()#13t.begin_fill()t.color('SeaGreen')t.seth(110)t.fd(32)t.seth(-120)t.fd(24)t.end_fill()#14t.begin_fill()t.color('SeaGreen')t.seth(110)t.fd(32)t.seth(-120)t.fd(22)t.end_fill()

#补充没上色的部分t.penup()t.pensize(7)t.goto(-99,-49)t.pendown()t.seth(-1)t.fd(86)t.seth(0)t.fd(6)t.seth(40)t.fd(30)t.seth(50)t.fd(48)t.seth(90)t.fd(15)t.done()

最后成品就在这里喽

和图片还是有所差距,有没有感觉一开始有点像蛇,第一个作品再接再厉,喜欢记得点赞哦

如果觉得《python turtle 海龟绘图小恐龙(《小猪佩奇》里的)》对你有帮助,请点赞、收藏,并留下你的观点哦!

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