• 让人春分日 Thonny 表情包


    1. import turtle
    2. # 画指定的任意圆弧
    3. def arc(sa, ea, x, y, r): # start angle,end angle,circle center,radius
    4. turtle.penup()
    5. turtle.goto(x, y)
    6. turtle.setheading(0)
    7. turtle.left(sa)
    8. turtle.fd(r)
    9. turtle.pendown()
    10. turtle.left(90)
    11. turtle.circle(r, (ea - sa))
    12. return turtle.position()
    13. turtle.hideturtle()
    14. # 画脸
    15. turtle.speed(5)
    16. turtle.setup(900, 600, 200, 200)
    17. turtle.pensize(5)
    18. turtle.right(90)
    19. turtle.penup()
    20. turtle.fd(100)
    21. turtle.left(90)
    22. turtle.pendown()
    23. turtle.begin_fill()
    24. turtle.pencolor("#B26A0F") # head side color
    25. turtle.circle(150)
    26. turtle.fillcolor("#F9E549") # face color
    27. turtle.end_fill()
    28. # 画嘴
    29. turtle.penup()
    30. turtle.goto(77, 20)
    31. turtle.pencolor("#744702")
    32. turtle.goto(0, 50)
    33. turtle.right(30)
    34. turtle.fd(110)
    35. turtle.right(90)
    36. turtle.pendown()
    37. turtle.begin_fill()
    38. turtle.fillcolor("#925902") # mouth color
    39. turtle.circle(-97, 160)
    40. turtle.goto(92, -3)
    41. turtle.end_fill()
    42. turtle.penup()
    43. turtle.goto(77, -25)
    44. # 画牙齿
    45. turtle.pencolor("white")
    46. turtle.begin_fill()
    47. turtle.fillcolor("white")
    48. turtle.goto(77, -24)
    49. turtle.goto(-81, 29)
    50. turtle.goto(-70, 43)
    51. turtle.goto(77, -8)
    52. turtle.end_fill()
    53. turtle.penup()
    54. turtle.goto(0, -100)
    55. turtle.setheading(0)
    56. turtle.pendown()
    57. # 画左边眼泪
    58. turtle.left(90)
    59. turtle.penup()
    60. turtle.fd(150)
    61. turtle.right(60)
    62. turtle.fd(-150)
    63. turtle.pendown()
    64. turtle.left(20)
    65. turtle.pencolor("#155F84") # tear side color
    66. turtle.fd(150)
    67. turtle.right(180)
    68. position1 = turtle.position()
    69. turtle.begin_fill()
    70. turtle.fillcolor("#7EB0C8") # tear color
    71. turtle.fd(150)
    72. turtle.right(20)
    73. turtle.left(270)
    74. turtle.circle(-150, 18)
    75. turtle.right(52)
    76. turtle.fd(110)
    77. position2 = turtle.position()
    78. turtle.goto(-33, 90)
    79. turtle.end_fill()
    80. # 画右边眼泪
    81. turtle.penup()
    82. turtle.goto(0, 0)
    83. turtle.setheading(0)
    84. turtle.left(90)
    85. turtle.fd(50)
    86. turtle.right(150)
    87. turtle.fd(150)
    88. turtle.left(150)
    89. turtle.fd(100)
    90. turtle.pendown()
    91. turtle.begin_fill()
    92. turtle.fd(-100)
    93. turtle.fillcolor("#7EB0C8") # tear color
    94. turtle.right(60)
    95. turtle.circle(150, 15)
    96. turtle.left(45)
    97. turtle.fd(66)
    98. turtle.goto(77, 20)
    99. turtle.end_fill()
    100. # 画眼睛
    101. turtle.penup()
    102. turtle.pencolor("#6C4E00") # eye color
    103. turtle.goto(-65, 75)
    104. turtle.setheading(0)
    105. turtle.left(27)
    106. turtle.fd(38)
    107. turtle.pendown()
    108. turtle.begin_fill()
    109. turtle.fillcolor("#6C4E00") # eye color
    110. turtle.left(90)
    111. turtle.circle(38, 86)
    112. turtle.goto(position2[0], position2[1])
    113. turtle.goto(position1[0], position1[1])
    114. turtle.end_fill()
    115. # 画手
    116. turtle.pencolor("#D57E18") # hand side color
    117. turtle.begin_fill()
    118. turtle.fillcolor("#EFBD3D") # hand color
    119. # 第一个手指
    120. arc(-110, 10, 110, -40, 30)
    121. turtle.circle(300, 35)
    122. turtle.circle(13, 120)
    123. turtle.setheading(-50)
    124. turtle.fd(20)
    125. turtle.setheading(130)
    126. # 第二个手指
    127. turtle.circle(200, 15)
    128. turtle.circle(12, 180)
    129. turtle.fd(40)
    130. turtle.setheading(137)
    131. # 第三个手指
    132. turtle.circle(200, 16)
    133. turtle.circle(12, 160)
    134. turtle.setheading(-35)
    135. turtle.fd(45)
    136. turtle.setheading(140)
    137. # 第四个手指
    138. turtle.circle(200, 13)
    139. turtle.circle(11, 160)
    140. turtle.setheading(-35)
    141. turtle.fd(40)
    142. turtle.setheading(145)
    143. # 第五个手指
    144. turtle.circle(200, 9)
    145. turtle.circle(10, 180)
    146. turtle.setheading(-31)
    147. turtle.fd(50)
    148. # 画最后手腕的部分
    149. turtle.setheading(-45)
    150. turtle.pensize(7)
    151. turtle.right(5)
    152. turtle.circle(180, 35)
    153. turtle.end_fill()
    154. turtle.begin_fill()
    155. turtle.setheading(-77)
    156. turtle.pensize(5)
    157. turtle.fd(50)
    158. turtle.left(-270)
    159. turtle.fd(7)
    160. turtle.pencolor("#EFBD3D")
    161. turtle.circle(30, 180)
    162. turtle.end_fill()
    163. # 测试
    164. # res=arc(70,220,90,50,300)
    165. # print(res[0],res[1])
    166. turtle.done()

  • 相关阅读:
    2022年6月第十三届蓝桥杯大赛软件赛全国决赛C++A组题解
    .NET Emit 入门教程:第六部分:IL 指令:7:详解 ILGenerator 指令方法:分支条件指令
    40. 组合总和 II
    [ flex ] -- 父盒子ul为flex布局时宽度不够,子盒子li无法被撑开的问题(li的宽度被压缩)
    Linux线程信号量
    杭电多校3 1012. Two Permutations dp*
    Stable Diffusion进阶玩法说明
    MongoDB的「Linux」安装及基本使用
    [附源码]计算机毕业设计springboot基于vue+mysql开发的考试系统
    身份证实名认证接口的三种方式、C#实名认证接口
  • 原文地址:https://blog.csdn.net/weixin_45268931/article/details/130909184