Skip to content Skip to sidebar Skip to footer

Update On The Fly A Ttk.optionmenu Without Affecting Its Previous Callback/command

I am doing a large GUI with different ttk.OptionMenu widgets that need to be updated often depending on the interaction with the user. Each time the user selects another value from

Solution 1:

There is an internal class _setit in tkinter module which is used by OptionMenu internally to populate the values. You can use this class as below:

from tkinter import filedialog, messagebox, ttk, _setit
...

for value in newList:
    menu.add_command(label=value, command=_setit(variable, value, printing))

Post a Comment for "Update On The Fly A Ttk.optionmenu Without Affecting Its Previous Callback/command"