Default window colour Tkinter and hex colour codes
I was trying to set a button's color to the system default. This is the best solution I've come across:
root.configure(background='SystemButtonFace')
Source: How to set default background colour tkinter
Not sure exactly what you're looking for, but will this work?
import Tkinter
mycolor = '#%02x%02x%02x' % (64, 204, 208) # set your favourite rgb color
mycolor2 = '#40E0D0' # or use hex if you prefer
root = Tkinter.Tk()
root.configure(bg=mycolor)
Tkinter.Button(root, text="Press me!", bg=mycolor, fg='black',
activebackground='black', activeforeground=mycolor2).pack()
root.mainloop()
If you just want to find the current value of the window, and set widgets to use it, cget
might be what you want:
import Tkinter
root = Tkinter.Tk()
defaultbg = root.cget('bg')
Tkinter.Button(root,text="Press me!", bg=defaultbg).pack()
root.mainloop()
If you want to set the default background color for new widgets, you can use the tk_setPalette(self, *args, **kw)
method:
root.tk_setPalette(background='#40E0D0', foreground='black',
activeBackground='black', activeForeground=mycolor2)
Tkinter.Button(root, text="Press me!").pack()
Then your widgets would have this background color by default, without having to set it in the widget parameters. There's a lot of useful information provided with the inline help functions import Tkinter; help(Tkinter.Tk)
The default color for Tkinter window I found was #F0F0F0