In this case, all button has last index value.
I hope to know why all button has last index.
def printIndex(row, col):
print("index = %d, %d" %(row,col))
def makeBoard(row, col):
window = Tk()
btlist = [0 for i in range(row)]
for i in range(row):
btlist[i] = [0 for j in range(col)]
for i in range(row):
for j in range(col):
btlist[i][j] = Button(window, text="a", command = lambda : printIndex(i, j))
btlist[i][j].grid(row=i,column=j)
makeBoard(5, 3)