Tkinter Button disabled background

  python, tkinter

I would like to define button color when disabled. Currently, I change the color of the button every time I change the button state.

button.config(state=DISABLED, bg="grey")

And then I need to change it back every time. Which is quite annoying.

button.config(state=NORMAL, bg="red")

There is an option for foreground disabledforeground so I expected there is a sister function for background, which is not.

button = Button(
    master,
    bg="red",
    disabledbackground="grey",
)

Is there some other option how to define disabledbackgroud eg. via theme or something like this?

Source: Python Questions

LEAVE A COMMENT