OBJECT 没有名为 'goto' 的属性。文档清楚地表明它确实如此
OBJECT has no attribute called 'goto'. Documentation shows it clearly does
import turtle as t
screen= t.Screen()
screen.title('welcome to my game')
screen.bgcolor('black')
starting_position = [(-40,0),(-20,0),(-0,0)]
segments=[]
for position in starting_position:
newsegment=t.Turtle('square')
newsegment=t.color('white')
newsegment.goto(position)
segments.append
#Says object has no attribute called 'goto'.文档说应该。
当您重新分配 newsegment=t.color('white')
时,newsegment
不再是海龟对象。
for position in starting_position:
newsegment=t.Turtle('square')
newsegment.color('white')
newsegment.goto(position)
import turtle as t
screen= t.Screen()
screen.title('welcome to my game')
screen.bgcolor('black')
starting_position = [(-40,0),(-20,0),(-0,0)]
segments=[]
for position in starting_position:
newsegment=t.Turtle('square')
newsegment=t.color('white')
newsegment.goto(position)
segments.append
#Says object has no attribute called 'goto'.文档说应该。
当您重新分配 newsegment=t.color('white')
时,newsegment
不再是海龟对象。
for position in starting_position:
newsegment=t.Turtle('square')
newsegment.color('white')
newsegment.goto(position)