Tkinter Ttk Optionmenu Losing Checkmark Highlight When Updating Option List
When I update a ttk.OptionMenu widget using this example: https://stackoverflow.com/a/7403530 , I lose the check mark that showed up before when I selected an item if I was using t
Solution 1:
The ttk
version, which you used previously, adds the checkmark functionality by default and a check will appear on the selected item. However, when you manually add items, you'll need to use the method add_radiobutton
instead of add_command
. This is what enables the check mark (on both tk
and ttk
versions).
import tkinter.tkk as tkk
def__init__(self, *args, **kwargs):
...
self.om = ttk.OptionMenu(self, self.om_variable)
...
def_reset_option_menu(self, options, index=None):
...
menu.add_radiobutton(
label=string,
command=tk._setit(self.om_variable, string)
)
...
Post a Comment for "Tkinter Ttk Optionmenu Losing Checkmark Highlight When Updating Option List"