我写了一个简单的代码,应该画一个正方形,见下文:
from turtle import Screen,Turtle
def draw(directions,length,angle,x=0,y=0):
s = Screen
t = Turtle
t.up()
t.setpos(x,y)
t.down()
# iterate over directions
for move in directions:
if move =='F':
t.forward(length)
elif move == 'L':
t.lt(angle)
elif move =='R':
t.rt(angle)
else:
pass
s.exitonclick()
但我收到一条我不明白的错误消息。见下文
>>> draw('FLFLFLFL',50,90)
Traceback (most recent call last):
File "<pyshell#43>", line 1, in <module>
draw('FLFLFLFL',50,90)
File "C:/Documents and Settings/RonnieE/Mina dokument/GradSchool/CSC401/Homework
7/test1.py", line 11, in draw
t.up()
TypeError: penup() missing 1 required positional argument: 'self'
我做错了什么?