Hi there,
Born again coding newb here .... (2 days in so far....)
I have a GUI that has buttons created based upon the number of lines from a csv file. That creation is no problem.
My issue is I'd like to pass on some form of useful information on a button click pertaining to each individual button.
Here is my simplified snippet of code:
Thanks!
Born again coding newb here .... (2 days in so far....)
I have a GUI that has buttons created based upon the number of lines from a csv file. That creation is no problem.
My issue is I'd like to pass on some form of useful information on a button click pertaining to each individual button.
Here is my simplified snippet of code:
# import from tkinter import * # window root = Tk() root.geometry('600x400') def button_click(args): Label(root, text = args).pack() for i in range(5): button = Button(root, text = "Button " + str(i), command=lambda: button_click([i])) button.pack() # run root.mainloop()Regardless of which button clicked, it will return the last value of i in the loop (4) . I'd like it to return the value of the button as it was created (either as a string or integer)
Thanks!