我想通过按Button1来更改Button2的背景颜色。这是我的工作:
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则无济于事。有帮助吗?