简体   繁体   中英

How can I change the border color of my OptionMenu in Tkinter?

I am having trouble changing the border/outline color of the Tkinter OptionMenu widget. I've uploaded a picture of what it currently looks like (NES.png is the text for the drop down menu): My Problem

I would like the sheer white border/outline to not exist, but I can not seem to find a parameter to do so. Here is my current code:

dropdown = tk.OptionMenu(parent, variable, default, *list)
dropdown.config(bg=color, fg="white", activebackground=select_color)
dropdown["menu"].config(bg=color, fg="white")
dropdown.grid(padx=self.padding, pady=self.spacing)

The "color" variable is currently set to a dark red color, and "select_color" is currently set to a bright red color. Is there any way to fix this? I am having the same problem with my slider/scale as well.

Figured it out. Bryan Oakley in the comments mentioned that it might be the highlightcolor, I tried changing the color of that. and it didn't change anything, Intellisense, however. saved the day, It suggested using highlightbackground and highlightthickness. either of which I can use to hide the outline.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM