Okym
Okym

Reputation: 259

Tkinter: OptionMenu object menu not working with highlightthickness=0

The highlightthickness = 0 config parameter is not working with the menu object and it's giving me an error:

_tkinter.TclError: unknown option "-highlightthickness"

However it does work on the widget itself but I would like to know if it's possible to remove the border from the drop down menu. (See examples below)

I've tried borderwidth = 0 as well and it does not change anything in the object menu's case.

Example

ratioList = ('1 : 1', '16 : 9')
root.v = StringVar()
root.v.set(ratioList[0])
ratioDropdown = OptionMenu(root, root.v, *ratioList)
ratioDropdown.place(x=170, y=155)
ratioDropdown.config(relief="flat", highlightthickness=0, font=("Montserrat", (12)), bg="#035be3", activebackground="#023c96",
activeforeground="white", fg="white", borderwidth="0", indicatoron=0)

ratioDropdown["menu"].config(font=("Montserrat", (12)), bg="#035be3", relief="flat", fg="white", activebackground="#023c96", borderwidth=0)

Upvotes: 4

Views: 626

Answers (2)

Sav
Sav

Reputation: 1

Try to use highlightbackground="#035be3" instead of bg="#035be3".

Upvotes: 0

user14923778
user14923778

Reputation:

There is no problem with your code, as far as I found that this border width is the default width (minimum present in OptionMenu always). As you have made the Menu size larger, the border width is appearing to be thicker.

Upvotes: 0

Related Questions