Alex
Alex

Reputation: 864

Why SystemButtonFace is not received as a color in linux but does in windows when using tkinter?

I was making an interface in windows using tkinter, and all my buttons had the color as "SystemButtonFace", then I moved to a linux computer and it throws an error, the color doesn't exist, and I changed it to white, but then I wondered if there was another way to do this, I made some research and apparently this is like a system value and Windows should return a hex code for the color but in Linux this value doesn't exist. Is there a way I can maybe add this value to the system? or should I just change the color values to another that can be used in both systems?

The button:

b1 = Button(root, text=" ", font =("Helvetica", 20), height=3, width=6, bg="SystemButtonFace", command= lambda:b_click(b1))

Here's the screenshot of the error:

enter image description here

Upvotes: 0

Views: 1176

Answers (2)

gino
gino

Reputation: 1

Try "gray85" or "gray90" and it should be very close to the system default colour.

Upvotes: 0

Bryan Oakley
Bryan Oakley

Reputation: 386220

The "why" is simply that's how the underlying tk library was designed. Some colors aren't supported on all platforms.

For the authoritative list of color names, see the tcl/tk man page for colors.

Upvotes: 1

Related Questions