Я использую собственную тему из ttk, и у меня было определенное поведение c для кнопок, и теперь они все зеленые, но я не могу создать красную.
def configure_style(self):
s = ttk.Style()
s.theme_settings(
"equilux",
{
"TButton": {
"configure": {"padding": 0},
"map": {
"foreground": [
("active", "#0be881"),
("!disabled", "#009432"),
],
"background": [("active", "#000"), ("!disabled", "#009432"),],
},
},
},
)
s.configure(
".", background=self.bg_color, font="{U.S. 101} 15 bold", foreground="white"
)
s.configure("title.TLabel", font="{U.S. 101} 30 bold", foreground="#e1b12c")
s.configure("time.TLabel", foreground="#e84118")
s.configure("res.TEntry", background="#000")
s.configure("rfood.TLabel", foreground="#e1b12c")
s.configure("yfood.TLabel", foreground="#e84118")
s.configure("exit.Button", background="#ff0000")
control_button = ttk.Button(common_frame, text=label, command=function, cursor="pirate", style="exit.TButton")
control_button.place(x=100 + 200 * index, y=400)
ОТВЕТ: Благодаря ответу stovfl мне удается перезаписать предыдущий пользовательский стиль, создав новое сопоставление для нового стиля.
s.map("exit.TButton", background=[('disabled','#000000'), ('active','#ff0000')])