I am adding drop downs dynamically based on user input. The user will input a title. Each word in the title has a list of synonyms associated with them. Tkinter will add drop downs of synonyms dynamically based on the user input. However I cannot individually access the value of each drop down.
The lists variable is a list of lists containing the synonyms for each word in the user input.
def ok(): print ("value is:" + variable.get()) i = 0 while i < len(lists): OPTIONS = lists[i] OPTIONS = OPTIONS.split(',') variable = StringVar(master) dropdown = OptionMenu(master, variable, *OPTIONS) dropdown.pack(side=LEFT, fill=X, expand=YES) button = Button(master, text="Swap", command=ok) button.pack(side=LEFT, expand=YES) i = i+1
Is there a way I can access the value set from my drop downs?