изменение цвета кнопки tkinter нажатием другой кнопки - PullRequest
0 голосов
/ 20 марта 2019

Я хочу изменить цвет фона Button2, нажав Button1.Вот что я делаю:

from Tkinter import *

class Application():
    def __init__(self, root):
        self.root = root
        self.Frame = Frame(self.root)
        self.Frame.pack()

        self.Button1 = Button(self.Frame, text = "Button 1", command = self.button1_press)
        self.Button1.pack()

        self.Button2 = Button(self.Frame, text = "Button 2")
        self.Button2.pack()

    def button1_press(self):
        self.Button2.config(bg = "red")

root = Tk()
app = Application(root)
root.mainloop()

Но нажатие кнопки 1 ничего не дает.Любая помощь?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...