I want tkinter to create a Label for every item in a list. Problem: this list can have various lengths cause it's based on user input.
I managed to create a variable for every item in the list. But how can I access each variable (assign Label and var_name.grid() ) if I don't know its name while writing the program?
keys = ["foo", "bar"]
count = 0
for key in keys:
    
    labelname = "label_w_" + str(key)
    globals()[labelname] = None
    # I can access the first variable created statically, but what about the others?
    label_w_foo = Label(window, text = key)
    label_w_foo.grid(row = count, column = 1)
    count += 1
window.update()
