When you do self.button = Button(...).grid(...) , what self.button is assigned is the result of the grid() command, not a reference to the created Button object.
You need to assign self.button variable before its packing / grid. It should look something like this:
self.button = Button(self,text="Click Me",command=self.color_change,bg="blue") self.button.grid(row = 2, column = 2, sticky = W)
Symon
source share