画蛇
import turtle
for i in range(len):
turtle.circle(rad, angle) # 画圆 rad:圆半径 angle:圆弧度
turtle.circle(-rad, angle)
turtle.circle(rad, angle/2)
turtle.fd(rad) # 表示直线爬行,forward, 参数表示爬行的距离
turtle.circle(neckrad+1, 180)
turtle.fd(rad*2/3)
def main():
turtle.setup(1300, 800, 0, 0) # 甚至窗口宽+高+起始x/y
pythonsize = 100
turtle.pensize(pythonsize) # 设置笔的宽度
turtle.pencolor("red") # 设置笔的颜色
turtle.seth(-40) # 设置笔的起始角度
drawSnake(40, 80, 5, pythonsize/2)
main()
""""
python 的调用方式
1:import 库名
调用的时:库.函数名
优点:可以更改函数中函数的名字
2, from 库名 import 函数名
"""