python 冰墩墩 雪容融
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 # -*- coding: UTF-8 -*- 2 # Write Python 2 code in this online editor and run it. 3 import turtle 4 turtle.title('冰墩墩') 5 turtle.speed(100) 6 # 左手 7 turtle.penup() 8 turtle.goto(177, 112) 9 turtle.pencolor("lightgray") 10 turtle.pensize(3) 11 turtle.fillcolor("white") 12 turtle.begin_fill() 13 turtle.pendown() 14 turtle.setheading(80) 15 turtle.circle(-45, 200) 16 turtle.circle(-300, 23) 17 turtle.end_fill() 18 # 左手内 19 turtle.penup() 20 turtle.goto(182, 95) 21 turtle.pencolor("black") 22 turtle.pensize(1) 23 turtle.fillcolor("black") 24 turtle.begin_fill() 25 turtle.setheading(95) 26 turtle.pendown() 27 turtle.circle(-37, 160) 28 turtle.circle(-20, 50) 29 turtle.circle(-200, 30) 30 turtle.end_fill() 31 # 轮廓 32 # 头顶 33 turtle.penup() 34 turtle.goto(-73, 230) 35 turtle.pencolor("lightgray") 36 turtle.pensize(3) 37 turtle.fillcolor("white") 38 turtle.begin_fill() 39 turtle.pendown() 40 turtle.setheading(20) 41 turtle.circle(-250, 35) 42 # 左耳 43 turtle.setheading(50) 44 turtle.circle(-42, 180) 45 # 左侧 46 turtle.setheading(-50) 47 turtle.circle(-190, 30) 48 turtle.circle(-320, 45) 49 # 左腿 50 turtle.circle(120, 30) 51 turtle.circle(200, 12) 52 turtle.circle(-18, 85) 53 turtle.circle(-180, 23) 54 turtle.circle(-20, 110) 55 turtle.circle(15, 115) 56 turtle.circle(100, 12) 57 # 右腿 58 turtle.circle(15, 120) 59 turtle.circle(-15, 110) 60 turtle.circle(-150, 30) 61 turtle.circle(-15, 70) 62 turtle.circle(-150, 10) 63 turtle.circle(200, 35) 64 turtle.circle(-150, 20) 65 # 右手 66 turtle.setheading(-120) 67 turtle.circle(50, 30) 68 turtle.circle(-35, 200) 69 turtle.circle(-300, 23) 70 # 右侧 71 turtle.setheading(86) 72 turtle.circle(-300, 26) 73 # 右耳 74 turtle.setheading(122) 75 turtle.circle(-53, 160) 76 turtle.end_fill() 77 78 # 右耳内 79 turtle.penup() 80 turtle.goto(-130, 180) 81 turtle.pencolor("black") 82 turtle.pensize(1) 83 turtle.fillcolor("black") 84 turtle.begin_fill() 85 turtle.pendown() 86 turtle.setheading(120) 87 turtle.circle(-28, 160) 88 turtle.setheading(210) 89 turtle.circle(150, 20) 90 turtle.end_fill() 91 92 # 左耳内 93 turtle.penup() 94 turtle.goto(90, 230) 95 turtle.setheading(40) 96 turtle.begin_fill() 97 turtle.pendown() 98 turtle.circle(-30, 170) 99 turtle.setheading(125) 100 turtle.circle(150, 23) 101 turtle.end_fill() 102 103 # 右手内 104 turtle.penup() 105 turtle.goto(-180, -55) 106 turtle.fillcolor("black") 107 turtle.begin_fill() 108 turtle.setheading(-120) 109 turtle.pendown() 110 turtle.circle(50, 30) 111 turtle.circle(-27, 200) 112 turtle.circle(-300, 20) 113 turtle.setheading(-90) 114 turtle.circle(300, 14) 115 turtle.end_fill() 116 117 # 左腿内 118 turtle.penup() 119 turtle.goto(108, -168) 120 turtle.fillcolor("black") 121 turtle.begin_fill() 122 turtle.pendown() 123 turtle.setheading(-115) 124 turtle.circle(110, 15) 125 turtle.circle(200, 10) 126 turtle.circle(-18, 80) 127 turtle.circle(-180, 13) 128 turtle.circle(-20, 90) 129 turtle.circle(15, 60) 130 turtle.setheading(42) 131 turtle.circle(-200, 29) 132 turtle.end_fill() 133 # 右腿内 134 turtle.penup() 135 turtle.goto(-38, -210) 136 turtle.fillcolor("black") 137 turtle.begin_fill() 138 turtle.pendown() 139 turtle.setheading(-155) 140 turtle.circle(15, 100) 141 turtle.circle(-10, 110) 142 turtle.circle(-100, 30) 143 turtle.circle(-15, 65) 144 turtle.circle(-100, 10) 145 turtle.circle(200, 15) 146 turtle.setheading(-14) 147 turtle.circle(-200, 27) 148 turtle.end_fill() 149 150 # 右眼 151 # 眼圈 152 turtle.penup() 153 turtle.goto(-64, 120) 154 turtle.begin_fill() 155 turtle.pendown() 156 turtle.setheading(40) 157 turtle.circle(-35, 152) 158 turtle.circle(-100, 50) 159 turtle.circle(-35, 130) 160 turtle.circle(-100, 50) 161 turtle.end_fill() 162 # 眼珠 163 turtle.penup() 164 turtle.goto(-47, 55) 165 turtle.fillcolor("white") 166 turtle.begin_fill() 167 turtle.pendown() 168 turtle.setheading(0) 169 turtle.circle(25, 360) 170 turtle.end_fill() 171 turtle.penup() 172 turtle.goto(-45, 62) 173 turtle.pencolor("darkslategray") 174 turtle.fillcolor("darkslategray") 175 turtle.begin_fill() 176 turtle.pendown() 177 turtle.setheading(0) 178 turtle.circle(19, 360) 179 turtle.end_fill() 180 turtle.penup() 181 turtle.goto(-45, 68) 182 turtle.fillcolor("black") 183 turtle.begin_fill() 184 turtle.pendown() 185 turtle.setheading(0) 186 turtle.circle(10, 360) 187 turtle.end_fill() 188 turtle.penup() 189 turtle.goto(-47, 86) 190 turtle.pencolor("white") 191 turtle.fillcolor("white") 192 turtle.begin_fill() 193 turtle.pendown() 194 turtle.setheading(0) 195 turtle.circle(5, 360) 196 turtle.end_fill() 197 198 # 左眼 199 # 眼圈 200 turtle.penup() 201 turtle.goto(51, 82) 202 turtle.fillcolor("black") 203 turtle.begin_fill() 204 turtle.pendown() 205 turtle.setheading(120) 206 turtle.circle(-32, 152) 207 turtle.circle(-100, 55) 208 turtle.circle(-25, 120) 209 turtle.circle(-120, 45) 210 turtle.end_fill() 211 # 眼珠 212 turtle.penup() 213 turtle.goto(79, 60) 214 turtle.fillcolor("white") 215 turtle.begin_fill() 216 turtle.pendown() 217 turtle.setheading(0) 218 turtle.circle(24, 360) 219 turtle.end_fill() 220 turtle.penup() 221 turtle.goto(79, 64) 222 turtle.pencolor("darkslategray") 223 turtle.fillcolor("darkslategray") 224 turtle.begin_fill() 225 turtle.pendown() 226 turtle.setheading(0) 227 turtle.circle(19, 360) 228 turtle.end_fill() 229 turtle.penup() 230 turtle.goto(79, 70) 231 turtle.fillcolor("black") 232 turtle.begin_fill() 233 turtle.pendown() 234 turtle.setheading(0) 235 turtle.circle(10, 360) 236 turtle.end_fill() 237 turtle.penup() 238 turtle.goto(79, 88) 239 turtle.pencolor("white") 240 turtle.fillcolor("white") 241 turtle.begin_fill() 242 turtle.pendown() 243 turtle.setheading(0) 244 turtle.circle(5, 360) 245 turtle.end_fill() 246 247 # 鼻子 248 turtle.penup() 249 turtle.goto(37, 80) 250 turtle.fillcolor("black") 251 turtle.begin_fill() 252 turtle.pendown() 253 turtle.circle(-8, 130) 254 turtle.circle(-22, 100) 255 turtle.circle(-8, 130) 256 turtle.end_fill() 257 258 # 嘴 259 turtle.penup() 260 turtle.goto(-15, 48) 261 turtle.setheading(-36) 262 turtle.begin_fill() 263 turtle.pendown() 264 turtle.circle(60, 70) 265 turtle.setheading(-132) 266 turtle.circle(-45, 100) 267 turtle.end_fill() 268 269 # 彩虹圈 270 turtle.penup() 271 turtle.goto(-135, 120) 272 turtle.pensize(5) 273 turtle.pencolor("cyan") 274 turtle.pendown() 275 turtle.setheading(60) 276 turtle.circle(-165, 150) 277 turtle.circle(-130, 78) 278 turtle.circle(-250, 30) 279 turtle.circle(-138, 105) 280 turtle.penup() 281 turtle.goto(-131, 116) 282 turtle.pencolor("slateblue") 283 turtle.pendown() 284 turtle.setheading(60) 285 turtle.circle(-160, 144) 286 turtle.circle(-120, 78) 287 turtle.circle(-242, 30) 288 turtle.circle(-135, 105) 289 turtle.penup() 290 turtle.goto(-127, 112) 291 turtle.pencolor("orangered") 292 turtle.pendown() 293 turtle.setheading(60) 294 turtle.circle(-155, 136) 295 turtle.circle(-116, 86) 296 turtle.circle(-220, 30) 297 turtle.circle(-134, 103) 298 turtle.penup() 299 turtle.goto(-123, 108) 300 turtle.pencolor("gold") 301 turtle.pendown() 302 turtle.setheading(60) 303 turtle.circle(-150, 136) 304 turtle.circle(-104, 86) 305 turtle.circle(-220, 30) 306 turtle.circle(-126, 102) 307 turtle.penup() 308 turtle.goto(-120, 104) 309 turtle.pencolor("greenyellow") 310 turtle.pendown() 311 turtle.setheading(60) 312 turtle.circle(-145, 136) 313 turtle.circle(-90, 83) 314 turtle.circle(-220, 30) 315 turtle.circle(-120, 100) 316 turtle.penup() 317 318 # 爱心 319 turtle.penup() 320 turtle.goto(220, 115) 321 turtle.pencolor("brown") 322 turtle.pensize(1) 323 turtle.fillcolor("brown") 324 turtle.begin_fill() 325 turtle.pendown() 326 turtle.setheading(36) 327 turtle.circle(-8, 180) 328 turtle.circle(-60, 24) 329 turtle.setheading(110) 330 turtle.circle(-60, 24) 331 turtle.circle(-8, 180) 332 turtle.end_fill() 333 334 # 五环 335 turtle.penup() 336 turtle.goto(-5, -170) 337 turtle.pendown() 338 turtle.pencolor("blue") 339 turtle.circle(6) 340 turtle.penup() 341 turtle.goto(10, -170) 342 turtle.pendown() 343 turtle.pencolor("black") 344 turtle.circle(6) 345 turtle.penup() 346 turtle.goto(25, -170) 347 turtle.pendown() 348 turtle.pencolor("brown") 349 turtle.circle(6) 350 turtle.penup() 351 turtle.goto(2, -175) 352 turtle.pendown() 353 turtle.pencolor("lightgoldenrod") 354 turtle.circle(6) 355 turtle.penup() 356 turtle.goto(16, -175) 357 turtle.pendown() 358 turtle.pencolor("green") 359 turtle.circle(6) 360 turtle.penup() 361 362 turtle.pencolor("black") 363 turtle.goto(-16, -160) 364 turtle.write("BEIJING 2022", font=('Arial', 10, 'bold italic')) 365 366 turtle.goto(145, -223) 367 turtle.pencolor("#DA2D20") 368 turtle.pendown() 369 turtle.write("冰墩墩", font=('华文琥珀', 20)) 370 turtle.hideturtle() 371 372 #弹幕 373 t=turtle(visible=False) #新建不可见的海龟对象 374 t1=turtle(visible=False) 375 t2=turtle(visible=False) 376 t3=turtle(visible=False) 377 t4=turtle(visible=False) 378 t5=turtle(visible=False) 379 t.penup() 380 t1.penup() 381 t2.penup() 382 t3.penup() 383 t4.penup() 384 t.color("gold") 385 t2.color("#DA2D20") 386 t3.color("lightblue") 387 t4.color("yellowgreen") 388 t.goto(400,0) #到最右边去 389 t1.goto(400,100) 390 t2.goto(400,200) 391 t3.goto(400,-200) 392 t4.goto(400,-100) 393 leftx = -1200 394 info=[] 395 while t.xcor() > leftx: 396 t.clear() #清空窗口,如果不清空频繁写字,每次的字就会覆盖在一起 397 t1.clear() 398 t2.clear() 399 t3.clear() 400 t4.clear() 401 t.write(info[t.xcor()%60],align='left',font=("Bahnschrift",30,"normal")) 402 t1.write("",align='left',font=("Segoe UI Emoji",20,"normal")) 403 t2.write("",align='left',font=("华文琥珀",20,"normal")) 404 t3.write("",align='left',font=("Bahnschrift",20,"normal")) 405 t4.write("",align='left',font=("Bahnschrift",30,"normal")) 406 pm.update() #刷新屏幕 407 time.sleep(0.02) #等待0.01秒 408 t.setx(t.xcor() - 1) #左移两个单位 409 t1.setx(t1.xcor() - 5) 410 t2.setx(t2.xcor() - 2) 411 t3.setx(t3.xcor() - 3) 412 t4.setx(t4.xcor() - 4) 413 414 turtle.hideturtle() 415 416 turtle.done()
View Code
希望大家能把自己的所学和他人一起分享,不要去鄙视别人索取时的贪婪,因为最应该被鄙视的是不肯分享时的吝啬。