Tkinter / ttk on Mac OS X Proper System Background Color (canvas)
Question
I would like to set the canvas background color to the same default system color as the frame above.
How can I determine the correct background color as used by other widgets in Tkinter/ttk on Mac OS X? I could use a fixed value but would prefer another way. Not sure if ttk is the way to go on OS X at all.
This example tries to get the background color from a frame and sets it to a canvas but it is a different color than the frame (white instead of light grey).
from Tkinter import *
from ttk import *
app = Tk()
s = Style()
t = Frame(app)
t.pack()
b1 = Button(t, text="y no right background color")
b1.pack()
b2= Button(t, text="y")
b2.pack()
#bg = "green"
#bg = "#eaeaea"
bg = s.lookup("TButton", "background")
print bg
s.configure('TFrame', background=bg)
c = Canvas(app, background=bg)
c.pack()
mainloop()
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow