the standard color selection dialog isn' just another pretty face--scripts can pass the hexadecimal color string it returns to the bg and fg widget color configuration options we met earlier that isbg and fg accept both color name ( blueand an ask color hex rgb result string that starts with ( the # ff in the last output line of the prior sectionthis adds another dimension of customization to tkinter guisinstead of hardcoding colors in your gui productsyou can provide button that pops up color selectors that let users choose color preferences on the fly simply pass the color string to widget config methods in callback handlersas in example - example - pp \gui\tour\setcolor py from tkinter import from tkinter colorchooser import askcolor def setbgcolor()(triplehexstraskcolor(if hexstrprint(hexstrpush config(bg=hexstrroot tk(push button(roottext='set background color'command=setbgcolorpush config(height= font=('times' 'bold')push pack(expand=yesfill=bothroot mainloop(this script creates the window in figure - when launched (its button' background is sort of greenbut you'll have to trust me on thispressing the button pops up the color selection dialog shown earlierthe color you pick in that dialog becomes the background color of this button after you press ok figure - setcolor main window dialogs