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")
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:

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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With