Tkinter button background color is not working in mac os

I am trying to change the bg color of a tkinter button on my mac (catalina) but instead of getting a colored background, it is showing a blank space in the layout.

The button code I used:

OpeningFile = Button(root, width=45, bg="#82CC6C", fg="black", text="OPEN", highlightbackground="#82CC6C", highlightthickness=1, borderwidth=0.2, relief="groove", padx=0, pady=0, command=openfile)

OpeningFile.grid()

Result I am getting:

Tkinter button background color is not working in mac os

What I expected:

Tkinter button background color is not working in mac os

I tried changing many parameters but it is still giving me the same result,

Can it be fixed or it is a bug in tkinter inside mac only?
(It was working properly in windows)

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I was looking for information on the same issue and it seems to be a limitation with tkinter using the MacOS APIs. Basically MacOS says the button colors can’t change so tkinter can’t change them.

https://github.com/python/cpython/issues/88409


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x