我正在用python为类编写2048,在尝试将sqaure[0]
的值赋值给self.textCoordinates
之后,我不断地得到错误'int' is not subscriptable
,然后在下一行我得到相同的错误,在开始的行self.textColour
def updateWindow(self):
for row in gme.array:
for square in row:
self.textCoordinates = square[0]
self.text = str(square[1])
if self.text != "None":
self.textColour = gme.colourArray[gme.numArray.index(square[1])]
self.drawUpdate()
updateCanvas()
gme.array
的值为:
self.array = [ [[[100,100], None], [[300,100], None], [[500,100], None], [[700,100], None]],
[[[100,300], None], [[300,300], None], [[500,300], None], [[700,300], None]],
[[[100,500], None], [[300,500], None], [[500,500], None], [[700,500], None]],
[[[100,700], None], [[300,700], None], [[500,700], None], [[700,700], None]] ]
目前没有回答
相关问题 更多 >
编程相关推荐