I am trying to disable a button using Tkinter:
from Tkinter import *
import os
class OptionWindow:
def __init__(self, value):
self.master = Tk()
self.master.minsize(500,500)
self.b1 = Button(self.master, text = "save Game", command =self.saveGame, state = NORMAL).grid(row = 0, column = 1, sticky = W)
def saveGame(self):
from modules.startingKit import options
options.saved = True
self.b1.configure (state = DISABLED)
Yet, for some reason, when I press the "save Game" button, its appearance does not change. What must I do to disable it?
self.master.mainloop()as the last thing in your__init__function. Or bring theTk()instance as a parameter toOptionWindow's constructor and pass it toself.master.