2

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)
Mike - SMT
  • 14,784
  • 4
  • 35
  • 79
Okym
  • 239
  • 2
  • 5
  • 24
  • Please provide a minimal reproducible example. – TheEagle Jan 20 '21 at 17:30
  • I did, check the code snippet. – Okym Jan 20 '21 at 17:35
  • No, please read [this](https://stackoverflow.com/help/minimal-reproducible-example) for how to create a minimal reproducible example – TheEagle Jan 20 '21 at 18:12
  • sorry, i cannot reproduce this behaviour, i can only see a thin gray border on the top and left of a _hovered_ menu item, but not such a thick white all around the complete menu. – TheEagle Jan 22 '21 at 00:08
  • 1
    @Myko Does this help? https://stackoverflow.com/questions/62269892/get-rid-of-white-border-around-option-menu/ – Henry Jan 26 '21 at 13:06
  • 1
    @JakubSzlaur Do not edit the OP's code. If you think the OP's code needs to be edited then request OP to edit the code. By changing the code you remove problems that exist in the original code and question making it harder if not impossible to properly address the OP's issue. – Mike - SMT Jan 27 '21 at 13:53

2 Answers2

0

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.

0

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

Sav
  • 1