Основной пример кода:
import tkinter as tk
win = tk.Tk()
def change_color_label(color):
color_change.set(color)
button1 = tk.Button(win, height=1, width=2, bg="Red",
command=lambda c='Red': change_color_label(c))
button1.pack()
button2 = tk.Button(win, height=1, width=2, bg="Blue",
command=lambda c='Blue': change_color_label(c))
button2.pack()
color_change = tk.StringVar()
mylabel = tk.Label(win, textvariable=color_change)
mylabel.pack()
win.mainloop()
или (без change_color_label):
import tkinter as tk
win = tk.Tk()
button1 = tk.Button(win, height=1, width=2, bg="Red",
command=lambda: color_change.set('Red'))
button1.pack()
button2 = tk.Button(win, height=1, width=2, bg="Blue",
command=lambda: color_change.set('Blue'))
button2.pack()
color_change = tk.StringVar()
mylabel = tk.Label(win, textvariable=color_change)
mylabel.pack()
win.mainloop()