Reputation: 11
What is the default button color's name? The color that appears if you don't enter any color like in bg. I want to delete the bg I entered during the program to the default color so it will look like it did in the beginning.
Thanks!
Upvotes: 0
Views: 1289
Reputation: 9766
As @jasonharper wrote in the comments. Since the default color is different between operating systems, the easiest way to reset the button color is to fetch and store it before setting it to some other color. Then you could simply use this value to reset the button to its default color.
import tkinter
root = tkinter.Tk()
button = tkinter.Button(root, text='Hello')
DEFAULT_BUTTON_COLOR = button['bg']
button['bg'] = 'blue'
button.pack()
# Somewhere in your code where you want to reset the color
button['bg'] = DEFAULT_BUTTON_COLOR
Upvotes: 2