i'm sure i'm missing laughably obvious, i've been staring @ 20 minutes , have no idea is.
class gui: def __init__(self): # creating frame , window self.winmain = tk.tk() self.topframe = tk.frame(self.winmain) self.midframe = tk.frame(self.winmain) self.botframe = tk.frame(self.winmain) # creating labels self.wordlabel = tk.label(self.topframe,text="word unscramble",width=18) self.wordlabel.pack(side="left") # scrambled word self.scrambledword = tk.stringvar() # open file of scrambled words dictlist = open('dict.txt', 'r') words = [] # empty list fill words line in dictlist: words.append(line) word = random.choice(words) print(word) word = ''.join(random.sample(word, len(word))) self.scrambledword.set(word) # label of scrambled word self.scwd = tk.label(self.topframe, textvariable=self.scrambledword, width=len(word)) self.scwd.pack(side="right") # entry label self.guessin = tk.label(self.midframe,text="your guess:", width=15) self.guessin.pack(side="left") # input box self.guess = tk.entry(self.midframe, width=15) self.guess.pack(side="right") # guess button self.guessbutton = tk.button(self.botframe,text="guess",command=self.guess) self.guessbutton.pack(side="left") # status variable self.stat = tk.stringvar() # status label self.status = tk.label(self.botframe, textvariable=self.stat,width=10) self.status.pack(side="right") self.topframe.pack(side="top") self.midframe.pack() self.botframe.pack() tk.mainloop() def guess(self): correct = false userguess = self.guess.get() self.stat.set(userguess) if userguess == self.scrambledword: self.stat.set("correct") correct = true print(correct)
sorry posting entire thing, have no idea problem lies. appreciated.