额!这个蟒蛇不太凶!
Python - 绘制小蟒蛇

代码示例

import turtle
import time


def drawSnake(rad, angle, len, neckrad):
    for _ in range(len):
        turtle.circle(rad, angle)
        turtle.circle(-rad, angle)
    turtle.circle(rad, angle / 2)
    turtle.forward(rad / 2)  # 直线前进
    turtle.circle(neckrad, 180)
    turtle.forward(rad / 4)


if __name__ == "__main__":
    turtle.setup(1500, 1400, 0, 0)
    turtle.pensize(30)  # 画笔尺寸
    turtle.pencolor("green")
    turtle.seth(-40)  # 前进的方向
    drawSnake(70, 80, 2, 15)
    time.sleep(2)

that's all, see also:

10分钟轻松学会 Python turtle 绘图

相关文章:

  • 2022-12-23
  • 2022-01-25
  • 2021-05-28
  • 2021-07-08
  • 2021-04-15
  • 2021-11-12
  • 2021-12-20
猜你喜欢
  • 2021-05-26
  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2021-04-19
  • 2022-12-23
相关资源
相似解决方案