0

can't able to change the tkinter optionmenu widget in python 2.7.13 version, it seems it works well in python 3.5 but not in python 2.7.13. Someone please help me. thanks in advance...

from Tkinter import *

master = Tk()

variable = StringVar(master)
variable.set("one") # default value

w = OptionMenu(master, variable, "one", "two", "three")
w["menu"].config(bg="GREEN",fg="red")
w.pack()

mainloop()
  • https://stackoverflow.com/questions/6178153/how-to-change-menu-background-color-of-tkinters-optionmenu-widget have you checked this question? Also, which operating system are you using? – Lafexlos Sep 05 '17 at 08:40
  • yea already checked it, actually this code is taken from answer posted on stackoverflow, but still it not working, and my operating system is windows 8. – Krishna Moorthy Sep 05 '17 at 13:24

1 Answers1

0

Currently what you code is doing is changeing the menu section of the dropdown

w["menu"].config(bg="GREEN",fg="red")

If you click on the menu you will see that the menu colours have changed I am guessing that you are trying to change the main section in which case you will need a new line saying

w.config(bg="GREEN",fg="red")
Elephant
  • 446
  • 1
  • 7
  • 19