Hi guys,
I'm having a problem creating multiple buttons in tkinter using a for loop. I just can't figure out how to make each button unique. First task is to fill a 9x9 grid with buttons, which is successfully acomplished by the command below.
Thank you very much for all of your help in advance.
I'm having a problem creating multiple buttons in tkinter using a for loop. I just can't figure out how to make each button unique. First task is to fill a 9x9 grid with buttons, which is successfully acomplished by the command below.
def grid_fill(): a=14 b=15 for j in range(9): for i in range(9): buttons = Button(main, text = 0, width = 7, height = 3) buttons.place(x = a, y = b) a+=76.7 a = 14 b+=76.7But my goal is not only to place these buttons but also assign each one a different command. The code above just places 81 buttons which are all the same. Any suggestions?
Thank you very much for all of your help in advance.

Larz60+ write Dec-06-2020, 10:26 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags in future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags in future posts.