Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/326.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Python从列表中填写海龟坐标?_Python_Coordinates_Fill_Turtle Graphics - Fatal编程技术网

如何使用Python从列表中填写海龟坐标?

如何使用Python从列表中填写海龟坐标?,python,coordinates,fill,turtle-graphics,Python,Coordinates,Fill,Turtle Graphics,我需要知道如何修复此代码,以便在调用名为“redlist”的列表时(该列表具有坐标列表),在调用move函数时填充这些点。这就是我到目前为止所做的: redlist=[] def move(): penup() if color()[0]=="red": #coordinates of redlist should be filled here def paint():

我需要知道如何修复此代码,以便在调用名为“redlist”的列表时(该列表具有坐标列表),在调用move函数时填充这些点。这就是我到目前为止所做的:

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())

我不知道你说的坐标是什么意思,但我叫它们
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())