- 帖子
- 17
- 精华
- 0
- 积分
- 158
- 阅读权限
- 20
- 注册时间
- 2018-2-23
- 最后登录
- 2018-11-25
|
请问如下绘snake图的代码有什么问题吗?运行错误提示是第一行,没明白。附件有py文件和错误提示截图。
>>> import turtle
>>>
>>> def drawSnake(rad, angle, len, neckrad):
for i in range(len):
turtle.circle(rad, angle)
turtle.circle(-rad, angle)
turtle.circle(rad, angle/2)
turtle.fd(rad)
turtle.circle(neckrad+1, 180)
turtle.fd(rad*2/3)
>>> def main():
turtle.setup(1300, 800, 0, 0)
pythonsize = 30
turtle.pensize(pythonsize)
turtle.pencolor("bule")
turtle.seth(-40)
drawSnake(40,80,5,pythonsize/2)
>>> main()
|
|