tkinteroptionmenu

How to fill the area of OptionMenu - tkinter


I want to fill the window with grey, however around the OptionMenu there is a missing area which isn't filled.

For example: let's take a simple code that will examine what is my problem.

from tkinter import *
master = Tk()
master.config(bg="grey")
variable = StringVar(master)
variable.set("hello")
w = OptionMenu(master, variable, "hello1", "hello2")
w.config(bg="grey")
w.pack()
mainloop()

and this is the result:

enter image description here

I really don't know how to get rid (fill) of the white part.

enter image description here


Solution

  • Adding highlightthickness = 0 to your w.config line will remove the border, but the widget will still appear raised. If you would like to make it totally flat you can also add relief = FLAT