में मेनलोप से बाहर निकलें हालांकि मैं अन्य भाषाओं में एक प्रयोगात्मक प्रोग्रामर हूं, मैं पाइथन में बहुत नया हूं। मैं शुरू करने के बाद मेनलोप छोड़ने के लिए एक बहुत ही सरल चीज करने की कोशिश कर रहा हूं। ऐसा लगता है कि यह एक बड़ा सौदा है। नीचे दिया गया कार्यक्रम केवल घटनाओं का अनुक्रम बनाता है। सबकुछ काम कर रहा है, लेकिन मैं अंतिम खिड़की को बंद करने में सक्षम नहीं हूं ... मुझे क्या करना चाहिए?पायथन
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()
आप 'रूट .withdraw() ' – user19911303