Changing the colour of the tk.optionmenu widget

Question:

I use this command to create a tk.optionmenu widget but its a grey colour and I want it to be white.

optionmenu = tk.OptionMenu(root,variable,*(variables)).place(x=375, y=175)

How do I change it to the white colour? I’ve tried this but it doesn’t seem to work. Thanks!

optionmenu = tk.OptionMenu(root,variable,*(variables)colour="White").place(x=375, y=175)
Asked By: Coder101

||

Answers:

You can change the background color by doing the following:

optionmenu['menu'].config(bg='red')

Or whatever color you want. You can find a list of colors here

You can inspect further keyword arguements you can configure by doing the following:

print(optionmenu['menu'].keys())

Which will return:

['activebackground', 'activeborderwidth', 'activeforeground', 'background', 'bd', 'bg', 
 'borderwidth', 'cursor', 'disabledforeground', 'fg', 'font', 'foreground', 'postcommand', 
 'relief', 'selectcolor', 'takefocus', 'tearoff', 'tearoffcommand', 'title', 'type']
Answered By: Pythonista

in which file is this .. my menu is light grey with white letters can’t read anything need to change it

Answered By: Rick
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.