绝对原创!教你用turtle工具画汤圆酱表情包

想必大家都很熟悉下面这个表情包吧,哈哈,我用代码做到的!

  1 # 汤圆酱代码
  2 # 作者李安国
  3 import turtle as t
  4 
  5 t.hideturtle()
  6 t.pensize(3)
  7 t.pu()
  8 t.goto(-10,0)
  9 t.down()
 10 t.lt(53)
 11 t.fd(20)
 12 t.rt(106)
 13 t.fd(20)
 14 
 15 t.pu()
 16 t.goto(72,-80)
 17 t.down()
 18 t.lt(90)
 19 t.circle(120,286)
 20 
 21 t.up()
 22 t.home()
 23 t.pu()
 24 t.goto(-48,0)
 25 t.down()
 26 t.lt(90)
 27 t.color("pink")
 28 t.fillcolor("pink")
 29 t.begin_fill()
 30 t.circle(24,360)
 31 t.end_fill()
 32 
 33 t.pu()
 34 t.goto(75,22)
 35 t.down()
 36 t.lt(90)
 37 t.color("pink")
 38 t.fillcolor("pink")
 39 t.begin_fill()
 40 t.circle(24,360)
 41 t.end_fill()
 42 
 43 t.up()
 44 t.home()
 45 t.pu()
 46 t.goto(-12,50)
 47 t.down()
 48 t.pensize(2)
 49 t.lt(90)
 50 t.color("black")
 51 t.circle(26,90)
 52 t.fd(20)
 53 t.circle(26,90)
 54 t.circle(13,90)
 55 t.fd(45)
 56 t.circle(13,90)
 57 
 58 t.up()
 59 t.home()
 60 t.pu()
 61 t.goto(90,50)
 62 t.down()
 63 t.pensize(2)
 64 t.lt(90)
 65 t.color("black")
 66 t.circle(26,90)
 67 t.fd(20)
 68 t.circle(26,90)
 69 t.circle(13,90)
 70 t.fd(45)
 71 t.circle(13,90)
 72 
 73 t.up()
 74 t.home()
 75 t.pu()
 76 t.goto(-27,56)
 77 t.down()
 78 t.lt(90)
 79 t.fillcolor("black")
 80 t.begin_fill()
 81 t.circle(19,360)
 82 t.end_fill()
 83 
 84 t.up()
 85 t.home()
 86 t.pu()
 87 t.goto(85,56)
 88 t.down()
 89 t.lt(90)
 90 t.fillcolor("black")
 91 t.begin_fill()
 92 t.circle(19,360)
 93 t.end_fill()
 94 
 95 t.up()
 96 t.home()
 97 t.pu()
 98 t.goto(-72,-80)
 99 t.down()
100 t.pensize(3)
101 t.rt(110)
102 t.circle(180,25)
103 
104 t.up()
105 t.home()
106 t.pu()
107 t.goto(-22,-120)
108 t.down()
109 t.fd(40)
110 t.circle(12,180)
111 t.fd(38)
112 
113 t.pu()
114 t.home()
115 t.rt(53)
116 t.pu()
117 t.goto(72,-80)
118 t.rt(53)
119 t.down()
120 t.circle(180,25)
121 
122 t.pu()
123 t.home()
124 t.rt(53)
125 t.pu()
126 t.goto(68,-116)
127 t.down()
128 t.circle(12,360)
129 
130 t.pu()
131 t.home()
132 t.pu()
133 t.goto(0,136)
134 t.down()
135 t.lt(90)
136 t.fd(24)
137 t.color("OliveDrab1")
138 t.fillcolor("OliveDrab1")
139 t.begin_fill()
140 t.circle(10,360)
141 t.end_fill()
142 t.lt(180)
143 t.fillcolor("OliveDrab1")
144 t.begin_fill()
145 t.circle(10,360)
146 t.end_fill()

另外这里有个查找turtle颜色库的表格:

入口

爱我没结果!
原文地址:https://www.cnblogs.com/angoli/p/12756229.html