May-10-2018, 07:47 PM
What is the correct way to exit something like this (simplified version)
class Main (object): def __init__(self): self.userGUI = Tk(basename="userGUIs") self.progressGUI = Tk(basename="progressGUIs") self.uiGUI = guiA(self, self.userGUI) self.uiGUI.pack() self.progGUI = guiB(self, self.progressGUI) self.progGUI.pack() self.uiGUI.doCode() def doSomeOtherStuff(): # Initiate a progress bar while this is happening and a new frame for the userGUI is being built self.progGUI.doProgress() # Run some calculations self.progGUI.iterateProgress() class guiA(tk.Frame): def __init__(self, parent, gui): tk.Frame.__init__(self,gui) def doCode(self): # Code to build GUI widgets, etc. # When submit button clicked do below self.parent.doSomeOtherStuff() class guiB(tk.Frame): def __init__(self, parent, gui): tk.Frame.__init__(self,gui) def doProgress(self): # build progress bar def iterateProgress(self): # update progressbarNow, I've left out the mainloop(), destroy(), and quit() methods because I'd like someone to show me exactly where they are supposed to go to be sure that all traces of all GUIs exit and are destroyed cleanly when the program completes. Do I need two mainloops? Do I need to 'destroy()' or 'quit()' both GUIs?