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
The following code generates 12 buttons ,4 in each row. The particular button required to be edited is called similar to calling a matrix element. As an example button[1,1] has been edited for background color and button[2,2] has been edited for foreground color and text. The programme is tested on on python3.6 pycharm console
from tkinter import *
root=Tk()
Buts={}
for r in range(3):
for c in range(4):
Buts[(r,c)]=Button(root,text='%s/%s'%(r,c),borderwidth=10)
Buts[r,c].grid(row=r,column=c)
Buts[1,1]['bg']='red'
Buts[2,2]['text']=['BUTTON2']
Buts[2,2]['fg']=['blue']
root.mainloop()