Reputation: 2332
I want to programmatically find out what color is being used for the background color of a tkinter ttk.Button
. To be clear, I'm not trying to set or change the background color (since that cannot be done), merely get the color so I can use that color elsewhere. The standard process of cget('background')
will not work for a ttk button, so how else might I get the button background color?
Note, this answer needs to be system independent.
Upvotes: 0
Views: 2189
Reputation: 2332
Found the answer myself eventually.
from tkinter import ttk
print(ttk.Style().lookup('TButton', 'background'))
Upvotes: 4