Why does the indicator in ttk.Menubutton not disappear? Why does the indicator in ttk.Menubutton not disappear? tkinter tkinter

Why does the indicator in ttk.Menubutton not disappear?


The indicator does not disappear because the ttk theme does not have an indicatoron option and style.configure() simply ignores the invalid options instead of raising an error.

However you probably can get rid of the indicator using style.layout(). The solution below does not work with the default theme on OSX, but it works for 'clam' and 'alt'. You seem to be using Windows so maybe it will also work for the Windows theme, otherwise you can change theme.

If you look at the output of style.layout('TMenubutton'), you will have something like

[('Menubutton.border',  {'sticky': 'nswe',   'children': [('Menubutton.focus',     {'sticky': 'nswe',      'children': [('Menubutton.indicator', {'side': 'right', 'sticky': ''}),       ('Menubutton.padding',        {'expand': '1',         'sticky': 'we',         'children': [('Menubutton.label',           {'side': 'left', 'sticky': ''})]})]})]})]

To get rid of the 'Menubutton.indicator', you can just remove it from the layout:

style.layout('TMenubutton', [('Menubutton.border',  {'sticky': 'nswe',   'children': [('Menubutton.focus',     {'sticky': 'nswe',      'children': [       ('Menubutton.padding',        {'expand': '1',         'sticky': 'we',         'children': [('Menubutton.label',           {'side': 'left', 'sticky': ''})]})]})]})])

If you need other menubuttons with an indicator, you can replace 'TMenubutton' by a custom name, e.g. 'noindicator.TMenubutton' and do btn_menu.configure(style='noindicator.TMenubutton') to use this layout for this particular menubutton.