I am trying to program a minesweeper game on python using tkinter. I started off by creating a grid of buttons using a two dimensional list of 10x10. Then I created each but
Try modifying your code as below:
self.b=[[0 for x in range(10)] for y in range(10)] #The 2 dimensional list
xp = yp = 0
for i in range(10):
for j in range(10):
self.b[i][j]=tkinter.Button(root,text=" ",command=lambda i=i,j=j: self.delete(i,j)) # creating the button
self.b[i][j].place(x=xp,y=yp) # placing the button
xp+=26 #because the width and height of the button is 26
yp+=26
xp=0
and:
def delete(self, i, j):
self.b[i][j].destroy()