How do populate a Tkinter optionMenu with items in a list How do populate a Tkinter optionMenu with items in a list tkinter tkinter

How do populate a Tkinter optionMenu with items in a list


lst in your code is a list with a single string.

Use a list with multiple menu names, and specify them as follow:

....lst = ["a","b","c","d","e","f"]OptionMenu(root, var, *lst, command=print_it).pack()....


In your code in line 2 you used = instead use == for your if statement and don't use the break keyword outside a loop instead use pass.Change it to the following:

if x == "Done":    pass