I'm doing my first GUI on Tkinter and I'm having some issues getting more than one button to activate after clicking one.
I have the button Main
that's always active by default, and once it's pressed it should activate Button1, Button2, Button3, Button5 and Button6
that are disabled by default. This is my code at the moment.
Function that activates the buttons:
def activateButtons():
for i in (Button1, Button2, Button3, Button5, Button6):
i.config(state=ENABLED)
Button that calls the function:
loadDB= tk.Button(
root,
width=10,
text = "Load DB.",
bg = "black",
fg = "blue",
command=lambda:[loadDBF(),activateButtons()]).pack(expand = True)
and the buttons:
Button1 = tk.Button(
root,
width= 15,
text= "Button 1",
bg="black",
fg="blue",
state=DISABLED).pack(expand = True)
Button2 = tk.Button(
root,
width= 15,
text= "Button 2",
bg="black",
fg="blue",
state=DISABLED).pack(expand = True)
Button3 = tk.Button(
root,
width= 15,
text= "Button3",
bg="black",
fg="blue",
state=DISABLED).pack(expand = True)
Button4 = tk.Button(
root,
width= 15,
text= "Button 4",
bg="black",
fg="blue",
state=DISABLED).pack(expand = True)
Button4 = tk.Button(
root,
width= 15,
text= "Button 1",
bg="black",
fg="blue",
state=DISABLED).pack(expand = True)
Button5 = tk.Button(
root,
width= 15,
text= "Button 1",
bg="black",
fg="blue",
state=DISABLED).pack(expand = True)
Button6 = tk.Button(
root,
width= 15,
text= "Button 1",
bg="black",
fg="blue",
state=DISABLED).pack(expand = True)
Any idea on how to get them to activate once I press loadDB
?