Although I am a kind of experimented programmer in other languages, I am very new in Python. I have been trying to do a very simple thing that is to quit the mainloop after starting. It seems that it is a big deal. The program below only makes a sequence of events. Everything seems to be working, but I am not able to close the final window... What should I do?
from Tkinter import *
root=Tk()
theMainFrame=Frame(root)
theMainFrame.pack()
class CloseAfterFinishFrame1(Frame): # Diz que herda os parametros de Frame
def __init__(self):
Frame.__init__(self,theMainFrame) # Inicializa com os parametros acima!!
Label(self,text="Hi",font=("Arial", 16)).pack()
button = Button (self, text = "I am ready", command=self.CloseWindow,font=("Arial", 12))
button.pack()
self.pack()
def CloseWindow(self):
self.forget()
CloseAfterFinishFrame2()
class CloseAfterFinishFrame2(Frame): # Diz que herda os parametros de Frame
def __init__(self):
Frame.__init__(self,theMainFrame) # Inicializa com os parametros acima!!
Label(self,text="Hey",font=("Arial", 16)).pack()
button = Button (self, text = "the End", command=self.CloseWindow,font=("Arial", 12))
button.pack()
self.pack()
def CloseWindow(self):
self.forget()
CloseEnd()
class CloseEnd():
theMainFrame.quit()
CloseAfterFinishFrame1()
theMainFrame.mainloop()
root .withdraw()
– Belated