Нужна кнопка меняющая стиль приложения и все кнопки, но основные кнопки делаю через цикл. Как повесить нужный цвет на все кнопки?
from tkinter import *
window = Tk()
window.title("DilerCountAnswers2")
window.geometry("360x340")
a = 'black'
b = 'white'
x10 = 10
for i in range(4):
butt = Button(window, text=i, bg = b, fg = a, font = 'Helvetica 14').place(x = x10, y = 20, width = 60, height = 35)
x10 += 80
def change_theme():
if butt_theme['text'] == 'dark':
butt_theme['text'] = 'light'
butt_theme['bg'] = b
butt_theme['fg'] = a
butt['bg'] = a
butt['fg'] = b
else:
butt_theme['text'] = 'dark'
butt_theme['bg'] = a
butt_theme['fg'] = b
butt['bg'] = b
butt['fg'] = a
butt_theme = Button(text = 'dark', bg = a, fg = b, font = 'Helvetica 12', command = change_theme)
butt_theme.place(x = 30, y = 200, width = 60, height = 35)
window.mainloop()