Reputation: 58
Recently started using ttk for improving my GUI looks, but i got stuck at editing ttk.OptionMenu style. As I uderstand code below should change background of all Radiobuttons and OptionMenus. For Radiobutton (and other elements I tried) it works just fine, but OptionMenu doesnt change at all.
s = ttk.Style()
s.configure("TRadiobutton", background="grey")
s.configure("TOptionMenu", background="grey")
Upvotes: 2
Views: 10859
Reputation: 118
To change the background of the drop down menu:
my_optionmenu["menu"].configure(bg="black")
If you run:
print(my_optionmenu["menu"].keys())
you get all of the options you can change for the OptionMenu widget
Upvotes: 2
Reputation: 33193
The style name for an OptionMenu is not TOptionMenu. For any widget the style name can get obtained using widget.winfo_class()
and for an OptionMenu
this returns TMenubutton
.
So s.configure("TMenubutton", background="red")
yields:
Upvotes: 7