冰墩墩代码来啦 代码 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306import turtle as tt.speed(20) #画笔速度t.title("冰墩墩")#画出左耳t.penup() #起笔t.goto(-130,150) #将画笔移动到指定位置t.setheading(160) #设置当前朝向的角度t.begin_fill() #开始填充图形t.pendown()t.circle(-30, 230)t.setheading(180) #设置当前朝向的角度t.circle(37, 90) #画圆,半径为正(负),表示圆心在画笔的左边(右边)画圆t.end_fill() #填充结束#画右耳 多多注意与画左耳的区别 很多参数都是相反的t.penup()t.goto(130,150)t.setheading(20)t.begin_fill()t.pendown()t.circle(30,230)t.setheading(0)t.circle(-37,90)t.end_fill()#画头#1.画上半部分头t.pensize(6) #设置画笔宽度为6t.penup()t.goto(0,230) #移动到合适位置t.setheading(5)t.pendown()t.circle(-134,60)t.pensize(6) #设置画笔宽度为6t.penup()t.goto(0,230) #移动到合适位置t.setheading(-185)t.pendown()t.circle(134,60)#2.画下半部分头#2.1 右半部分t.penup()t.goto(130, 150)t.setheading(-65)t.pendown()t.circle(-200, 90)#2.2 左半部分t.penup()t.goto(-130, 150)t.setheading(-115)t.pendown()t.circle(200, 90)#2.3 下半部分t.penup()t.setheading(-31)t.pendown()t.circle(60, 60)#眼睛#左眼眼圈t.speed(1000)t.penup()t.goto(-110, 90)t.setheading(-45)t.begin_fill()t.pendown()a = 0.2for i in range(120): if 0 <= i < 30 or 60 <= i < 90: a = a + 0.1 t.speed(100) t.lt(3) # 向左转3度 t.fd(a) # 向前走a的步长 else: a = a - 0.1 t.speed(100) t.lt(3) t.fd(a)t.end_fill()# 左眼眼白t.fillcolor("white")t.penup()t.goto(-70, 110)t.setheading(0)t.begin_fill()t.pendown()t.circle(14, 360)t.end_fill()# 左眼眼珠t.penup()t.goto(-70, 117)t.setheading(0)t.begin_fill()t.pendown()t.circle(6, 360)t.end_fill()#右眼眼圈t.penup()t.goto(105, 90)t.setheading(45)t.fillcolor("black")t.pencolor("black")t.begin_fill()t.pendown()a = 0.2for i in range(120): if 0 <= i < 30 or 60 <= i < 90: a = a + 0.1 t.speed(100) t.lt(3) # 向左转3度 t.fd(a) # 向前走a的步长 else: a = a - 0.1 t.speed(100) t.lt(3) t.fd(a)t.end_fill()# 右眼眼白t.fillcolor("white")t.penup()t.goto(73, 110)t.setheading(0)t.begin_fill()t.pendown()t.circle(14, 360)t.end_fill()# 右眼眼珠t.penup()t.goto(74, 117)t.setheading(0)t.begin_fill()t.pendown()t.circle(6, 360)t.end_fill()#鼻子 鼻子就简单画了下,就是一个等边三角新t.pencolor("black") #定义画笔颜色t.fillcolor("black") #定义填充颜色t.penup() #起笔t.goto(-8,105) #移动到某个位置t.begin_fill() #开始填充颜色t.pendown()t.fd(20) #向前移动指定距离t.seth(-120) #旋转角度t.fd(20)t.seth(120)t.fd(20)t.end_fill() #结束填充颜色# 嘴t.penup()t.goto(-22, 70)t.setheading(-30)t.fillcolor("red")t.begin_fill()t.pendown()t.circle(50, 60)t.setheading(-120)t.circle(-100, 15)t.circle(-15, 90)t.circle(-100, 15)t.end_fill()#奥运五环#1环t.pensize(3)t.pencolor("black")t.penup()t.goto(10,0)t.pendown()t.circle(20)#2环t.pensize(3)t.pencolor("blue")t.penup()t.goto(30,0)t.pendown()t.circle(20)#3环t.pensize(3)t.pencolor("red")t.penup()t.goto(0,-10)t.pendown()t.circle(20)#4环t.pensize(3)t.pencolor("yellow")t.penup()t.goto(20,-10)t.pendown()t.circle(20)#五环t.pensize(3)t.pencolor("green")t.penup()t.goto(40,-10)t.pendown()t.circle(20)#胳膊#右胳膊t.pencolor("black")t.fillcolor("black")t.pensize(6)t.penup()t.goto(152,50)t.setheading(60)t.begin_fill()t.pendown()t.fd(100)t.setheading(70)t.circle(20, 180)t.fd(30)t.circle(-5, 160)t.end_fill()#左胳膊t.pencolor("black")t.fillcolor("black")t.pensize(6)t.penup()t.goto(-145,30)t.setheading(-120)t.begin_fill()t.pendown()t.fd(100)t.setheading(-110)t.circle(20, 180)t.fd(50)t.circle(-5, 100)t.end_fill()#腿#左腿t.fillcolor("black")t.penup()t.goto(-95,-77)t.begin_fill()t.pendown()t.setheading(-90)t.circle(-140, 20) #第一个参数为半径,第二个参数为角度t.circle(5, 109)t.fd(30)t.circle(10,120)t.setheading(90)t.circle(-140, 10)t.end_fill()#右腿t.fillcolor("black")t.penup()t.goto(95,-80)t.begin_fill()t.pendown()t.setheading(-90)t.circle(140, 20) #第一个参数为半径,第二个参数为角度t.circle(-5, 109)t.fd(30)t.circle(-10,120)t.setheading(90)t.circle(140, 10)t.end_fill()#冰糖外壳t.pensize(3)t.penup()t.goto(-138, 147)t.setheading(160)t.pendown()t.circle(-40, 200)t.setheading(50)t.circle(-128, 100)t.setheading(40)t.circle(-40, 215)t.setheading(-60)t.fd(25)t.circle(2, 200)t.setheading(65)t.fd(45)t.circle(-30, 180)t.fd(100)t.circle(2, 25)t.circle(-200, 47)t.circle(2, 60)t.circle(140, 23)t.circle(-2, 90)t.setheading(180)t.fd(75)t.circle(-2, 90)t.fd(25)t.setheading(-160)t.circle(-140, 60)t.setheading(-90)t.fd(30)#显示图形t.hideturtle() #隐藏画笔的turtle形状t.showturtle()t.done() #必须是乌龟图形程序中的最后一个语句。 代码还有一点没有完善,会继续改进 赏 谢谢你请我吃糖果 支付宝 微信 扫一扫,分享到微信