Tengo este código, el cual la idea es cambiar los atributos de varios botones en Tkinter.
for i in range (0, 8):
c = (i + 1)
btn1 = "boton"+str(b)+str(c)
if locals()["columna_"+str(b)][i] == "1":
#toggle3g(btn1, 11, 64)
btn = locals()[btn1]
btn.config(relief="sunken",bg="green1")
print(btn, "ON!!!")
else:
#toggle3goff(btn1, 11, 64)
btn = locals()[btn1]
btn.config(relief="sunken",bg="green1")
print(btn, "OFF!!!")
Me devuelve:
KeyError: 'boton11'