0

我需要知道如何修复此代码,以便当调用具有坐标列表的名为“redlist”的列表时,它会在调用移动函数时填充这些点。这是我到目前为止所拥有的:

redlist=[]
def move():
        penup()
        if color()[0]=="red":                      
        #coordinates of redlist should be filled here               

def paint():
        pendown()
        if color()[0]=="red":
                begin_fill
                redlist.append(pos())
4

1 回答 1

0

我不知道你的意思是什么坐标,但我打电话给x他们y

redlist=[]
def move():
        penup()
        if color()[0]=="red":                      
            x = 1 # replace this line
            y = 2 # replace this line
            redlist.append((x, y)) # you can access them by #x, y = redlist[-1]
        #coordinates of redlist should be filled here               

def paint():
        pendown()
        if color()[0]=="red":
                begin_fill
                redlist.append(pos())
于 2013-04-08T17:46:10.523 回答