还在一“墩”难求?python教你人手一“墩”(附源码)

小尘哥

共 6731字,需浏览 14分钟

 ·

2022-02-19 06:40

先上效果图b982b586697d56036c4fcd430a208795.webp

再上代码(请注意第一行,因为有中文,要不会执行时会有报错)

  1. # -*- coding: utf-8 -*

  2. import turtle

  3. turtle.title('PythonBingDwenDwen')


  4. turtle.speed(500)# 速度


  5. # 左手

  6. turtle.penup()

  7. turtle.goto(177,112)

  8. turtle.pencolor("lightgray")

  9. turtle.pensize(3)

  10. turtle.fillcolor("white")

  11. turtle.begin_fill()

  12. turtle.pendown()

  13. turtle.setheading(80)

  14. turtle.circle(-45,200)

  15. turtle.circle(-300,23)

  16. turtle.end_fill()


  17. # 左手内

  18. turtle.penup()

  19. turtle.goto(182,95)

  20. turtle.pencolor("black")

  21. turtle.pensize(1)

  22. turtle.fillcolor("black")

  23. turtle.begin_fill()

  24. turtle.setheading(95)

  25. turtle.pendown()

  26. turtle.circle(-37,160)

  27. turtle.circle(-20,50)

  28. turtle.circle(-200,30)

  29. turtle.end_fill()

  30. # 轮廓

  31. # 头顶

  32. turtle.penup()

  33. turtle.goto(-73,230)

  34. turtle.pencolor("lightgray")

  35. turtle.pensize(3)

  36. turtle.fillcolor("white")

  37. turtle.begin_fill()

  38. turtle.pendown()

  39. turtle.setheading(20)

  40. turtle.circle(-250,35)

  41. # 左耳

  42. turtle.setheading(50)

  43. turtle.circle(-42,180)

  44. # 左侧

  45. turtle.setheading(-50)

  46. turtle.circle(-190,30)

  47. turtle.circle(-320,45)

  48. # 左腿

  49. turtle.circle(120,30)

  50. turtle.circle(200,12)

  51. turtle.circle(-18,85)

  52. turtle.circle(-180,23)

  53. turtle.circle(-20,110)

  54. turtle.circle(15,115)

  55. turtle.circle(100,12)

  56. # 右腿

  57. turtle.circle(15,120)

  58. turtle.circle(-15,110)

  59. turtle.circle(-150,30)

  60. turtle.circle(-15,70)

  61. turtle.circle(-150,10)

  62. turtle.circle(200,35)

  63. turtle.circle(-150,20)

  64. # 右手

  65. turtle.setheading(-120)

  66. turtle.circle(50,30)

  67. turtle.circle(-35,200)

  68. turtle.circle(-300,23)

  69. # 右侧

  70. turtle.setheading(86)

  71. turtle.circle(-300,26)

  72. # 右耳

  73. turtle.setheading(122)

  74. turtle.circle(-53,160)

  75. turtle.end_fill()


  76. # 右耳内

  77. turtle.penup()

  78. turtle.goto(-130,180)

  79. turtle.pencolor("black")

  80. turtle.pensize(1)

  81. turtle.fillcolor("black")

  82. turtle.begin_fill()

  83. turtle.pendown()

  84. turtle.setheading(120)

  85. turtle.circle(-28,160)

  86. turtle.setheading(210)

  87. turtle.circle(150,20)

  88. turtle.end_fill()


  89. # 左耳内

  90. turtle.penup()

  91. turtle.goto(90,230)

  92. turtle.setheading(40)

  93. turtle.begin_fill()

  94. turtle.pendown()

  95. turtle.circle(-30,170)

  96. turtle.setheading(125)

  97. turtle.circle(150,23)

  98. turtle.end_fill()


  99. # 右手内

  100. turtle.penup()

  101. turtle.goto(-180,-55)

  102. turtle.fillcolor("black")

  103. turtle.begin_fill()

  104. turtle.setheading(-120)

  105. turtle.pendown()

  106. turtle.circle(50,30)

  107. turtle.circle(-27,200)

  108. turtle.circle(-300,20)

  109. turtle.setheading(-90)

  110. turtle.circle(300,14)

  111. turtle.end_fill()


  112. # 左腿内

  113. turtle.penup()

  114. turtle.goto(108,-168)

  115. turtle.fillcolor("black")

  116. turtle.begin_fill()

  117. turtle.pendown()

  118. turtle.setheading(-115)

  119. turtle.circle(110,15)

  120. turtle.circle(200,10)

  121. turtle.circle(-18,80)

  122. turtle.circle(-180,13)

  123. turtle.circle(-20,90)

  124. turtle.circle(15,60)

  125. turtle.setheading(42)

  126. turtle.circle(-200,29)

  127. turtle.end_fill()

  128. # 右腿内

  129. turtle.penup()

  130. turtle.goto(-38,-210)

  131. turtle.fillcolor("black")

  132. turtle.begin_fill()

  133. turtle.pendown()

  134. turtle.setheading(-155)

  135. turtle.circle(15,100)

  136. turtle.circle(-10,110)

  137. turtle.circle(-100,30)

  138. turtle.circle(-15,65)

  139. turtle.circle(-100,10)

  140. turtle.circle(200,15)

  141. turtle.setheading(-14)

  142. turtle.circle(-200,27)

  143. turtle.end_fill()


  144. # 右眼

  145. # 眼圈

  146. turtle.penup()

  147. turtle.goto(-64,120)

  148. turtle.begin_fill()

  149. turtle.pendown()

  150. turtle.setheading(40)

  151. turtle.circle(-35,152)

  152. turtle.circle(-100,50)

  153. turtle.circle(-35,130)

  154. turtle.circle(-100,50)

  155. turtle.end_fill()

  156. # 眼珠

  157. turtle.penup()

  158. turtle.goto(-47,55)

  159. turtle.fillcolor("white")

  160. turtle.begin_fill()

  161. turtle.pendown()

  162. turtle.setheading(0)

  163. turtle.circle(25,360)

  164. turtle.end_fill()

  165. turtle.penup()

  166. turtle.goto(-45,62)

  167. turtle.pencolor("darkslategray")

  168. turtle.fillcolor("darkslategray")

  169. turtle.begin_fill()

  170. turtle.pendown()

  171. turtle.setheading(0)

  172. turtle.circle(19,360)

  173. turtle.end_fill()

  174. turtle.penup()

  175. turtle.goto(-45,68)

  176. turtle.fillcolor("black")

  177. turtle.begin_fill()

  178. turtle.pendown()

  179. turtle.setheading(0)

  180. turtle.circle(10,360)

  181. turtle.end_fill()

  182. turtle.penup()

  183. turtle.goto(-47,86)

  184. turtle.pencolor("white")

  185. turtle.fillcolor("white")

  186. turtle.begin_fill()

  187. turtle.pendown()

  188. turtle.setheading(0)

  189. turtle.circle(5,360)

  190. turtle.end_fill()


  191. # 左眼

  192. # 眼圈

  193. turtle.penup()

  194. turtle.goto(51,82)

  195. turtle.fillcolor("black")

  196. turtle.begin_fill()

  197. turtle.pendown()

  198. turtle.setheading(120)

  199. turtle.circle(-32,152)

  200. turtle.circle(-100,55)

  201. turtle.circle(-25,120)

  202. turtle.circle(-120,45)

  203. turtle.end_fill()

  204. # 眼珠

  205. turtle.penup()

  206. turtle.goto(79,60)

  207. turtle.fillcolor("white")

  208. turtle.begin_fill()

  209. turtle.pendown()

  210. turtle.setheading(0)

  211. turtle.circle(24,360)

  212. turtle.end_fill()

  213. turtle.penup()

  214. turtle.goto(79,64)

  215. turtle.pencolor("darkslategray")

  216. turtle.fillcolor("darkslategray")

  217. turtle.begin_fill()

  218. turtle.pendown()

  219. turtle.setheading(0)

  220. turtle.circle(19,360)

  221. turtle.end_fill()

  222. turtle.penup()

  223. turtle.goto(79,70)

  224. turtle.fillcolor("black")

  225. turtle.begin_fill()

  226. turtle.pendown()

  227. turtle.setheading(0)

  228. turtle.circle(10,360)

  229. turtle.end_fill()

  230. turtle.penup()

  231. turtle.goto(79,88)

  232. turtle.pencolor("white")

  233. turtle.fillcolor("white")

  234. turtle.begin_fill()

  235. turtle.pendown()

  236. turtle.setheading(0)

  237. turtle.circle(5,360)

  238. turtle.end_fill()


  239. # 鼻子

  240. turtle.penup()

  241. turtle.goto(37,80)

  242. turtle.fillcolor("black")

  243. turtle.begin_fill()

  244. turtle.pendown()

  245. turtle.circle(-8,130)

  246. turtle.circle(-22,100)

  247. turtle.circle(-8,130)

  248. turtle.end_fill()


  249. # 嘴

  250. turtle.penup()

  251. turtle.goto(-15,48)

  252. turtle.setheading(-36)

  253. turtle.begin_fill()

  254. turtle.pendown()

  255. turtle.circle(60,70)

  256. turtle.setheading(-132)

  257. turtle.circle(-45,100)

  258. turtle.end_fill()


  259. # 彩虹圈

  260. turtle.penup()

  261. turtle.goto(-135,120)

  262. turtle.pensize(5)

  263. turtle.pencolor("cyan")

  264. turtle.pendown()

  265. turtle.setheading(60)

  266. turtle.circle(-165,150)

  267. turtle.circle(-130,78)

  268. turtle.circle(-250,30)

  269. turtle.circle(-138,105)

  270. turtle.penup()

  271. turtle.goto(-131,116)

  272. turtle.pencolor("slateblue")

  273. turtle.pendown()

  274. turtle.setheading(60)

  275. turtle.circle(-160,144)

  276. turtle.circle(-120,78)

  277. turtle.circle(-242,30)

  278. turtle.circle(-135,105)

  279. turtle.penup()

  280. turtle.goto(-127,112)

  281. turtle.pencolor("orangered")

  282. turtle.pendown()

  283. turtle.setheading(60)

  284. turtle.circle(-155,136)

  285. turtle.circle(-116,86)

  286. turtle.circle(-220,30)

  287. turtle.circle(-134,103)

  288. turtle.penup()

  289. turtle.goto(-123,108)

  290. turtle.pencolor("gold")

  291. turtle.pendown()

  292. turtle.setheading(60)

  293. turtle.circle(-150,136)

  294. turtle.circle(-104,86)

  295. turtle.circle(-220,30)

  296. turtle.circle(-126,102)

  297. turtle.penup()

  298. turtle.goto(-120,104)

  299. turtle.pencolor("greenyellow")

  300. turtle.pendown()

  301. turtle.setheading(60)

  302. turtle.circle(-145,136)

  303. turtle.circle(-90,83)

  304. turtle.circle(-220,30)

  305. turtle.circle(-120,100)

  306. turtle.penup()


  307. # 爱心

  308. turtle.penup()

  309. turtle.goto(220,115)

  310. turtle.pencolor("brown")

  311. turtle.pensize(1)

  312. turtle.fillcolor("brown")

  313. turtle.begin_fill()

  314. turtle.pendown()

  315. turtle.setheading(36)

  316. turtle.circle(-8,180)

  317. turtle.circle(-60,24)

  318. turtle.setheading(110)

  319. turtle.circle(-60,24)

  320. turtle.circle(-8,180)

  321. turtle.end_fill()


  322. # 五环

  323. turtle.penup()

  324. turtle.goto(-5,-170)

  325. turtle.pendown()

  326. turtle.pencolor("blue")

  327. turtle.circle(6)

  328. turtle.penup()

  329. turtle.goto(10,-170)

  330. turtle.pendown()

  331. turtle.pencolor("black")

  332. turtle.circle(6)

  333. turtle.penup()

  334. turtle.goto(25,-170)

  335. turtle.pendown()

  336. turtle.pencolor("brown")

  337. turtle.circle(6)

  338. turtle.penup()

  339. turtle.goto(2,-175)

  340. turtle.pendown()

  341. turtle.pencolor("lightgoldenrod")

  342. turtle.circle(6)

  343. turtle.penup()

  344. turtle.goto(16,-175)

  345. turtle.pendown()

  346. turtle.pencolor("green")

  347. turtle.circle(6)

  348. turtle.penup()


  349. turtle.pencolor("black")

  350. turtle.goto(-16,-160)

  351. turtle.write("BEIJING 2022", font=('Arial',10,'bold italic'))

  352. turtle.hideturtle()


  353. turtle.done()


浏览 19
点赞
评论
收藏
分享

手机扫一扫分享

分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

分享
举报