我不斷收到以下錯誤: AttributeError的:「NoneType」對象有沒有屬性「配置」如何更改按鈕的顏色與Tkinter的
# create color button
self.button = Button(self,
text = "Click Me",
command = self.color_change,
bg = "blue"
).grid(row = 2, column = 2, sticky = W)
def color_change(self):
"""Changes the button's color"""
self.button.configure(bg = "red")
優秀,這是修復!非常感謝! – 2011-04-04 20:41:45
如果您已經制作好按鈕,您如何更改背景? – RhetoricalRuvim 2018-02-01 00:17:49