Most programmers with experience in dealing with threaded applications are happy to avoid the insidious bugs that result when the complex and subtle rules for threads are violated.
Unfortunately, one place where threads really shine is where two components of an application compete for resources.
Said that, consider this reduced version already fixed (note that it could be much smaller): from Tkinter import Tk, String Var import ttk class Calculator: def __init__(self, state): self.state = state def ac(self): self.state.set('') def state_num(self, num): self.state.set('%s%d' % (self.state.get(), num)) #Main Window Setup: #Root setup root = Tk() root.title("Generic Calculator") Entered Setup = String Var('') calc = Calculator(Entered Setup) #Parent frame setup mainframe = ttk.
Frame(root, padding="8") mainframe.grid(column=0, row=0) mainframe.columnconfigure(0, weight=1) mainframe.rowconfigure(0, weight=1) #Button setup ttk.
103 messages have been posted for this article Visit https:// Meter-Managed-Direct X to post and view comments on this article, or click here to get a print view with messages.
Like the canvas widget, Tk's text widget is an immensely flexible and powerful tool which can be used for a wide variety of tasks.
Label(mainframe,textvariable=Entered Setup).grid(column=1,row=1,columnspan=5) Entered Setup.set(Entered) root.mainloop() does not create some form of link between Entered Setup and Entered, modifying Entered does not issue updates in Entered Setup.
This then allows toggling between "TYPE A" (conventional algorithm) and "TYPE B" (newly added algorithm) by pressing the [TYPE](F6) key.
Another possibility, surely, is to use Sometimes, though, using another process isn't feasible (you may, for instance, need to be portable to Macintosh) or you have other reasons for wanting to keep your calculations in the same address space as your GUI.