I am trying to create multiple buttons on a loop, something like:
def press_button(button):
button.configure(bg="red")
root = tkinter.Tk()
for i in range(4):
quick_button = tkinter.Button(root, text=str(i) ,font=("courier", 30),
command=lambda: press_button(quick_button))
quick_button.grid(row=i, pady=3, padx=3)
root.mainloop()
but I want each button to send different argument, what I want is that each button will send different argument, but what happened is that they all set to the same thing, so when I press the first button, the three buttons are being colored. Also, is there a way to reference buttons without putting them in a dictionary when creating them?
Any help will be appreciated