0
我可以讓我的程序關閉整個程序,無論誰我還沒有想出一個辦法,以便當一個按鈕被點擊時它只關閉那個窗口而不是整個程序。只關閉一個tkinter窗口
from tkinter import *
class First(object):
def __init__(self, master):
self.master = master
self.admin_btn = Button(self.master, text = "First", command = self.second)
self.admin_btn.grid(row = 0, column = 0)
def second(self):
self.w = second(self.master)
self.master.wait_window(self.w.master)
class second(object):
def __init__(self, master):
self.master = Toplevel(master)
self.second = Button(self.master, text = "Second", command = self.third)
self.second.grid(row= 0, column = 0)
def third(self):
self.w = third(self.master)
self.master.wait_window(self.w.master)
class third(object):
def __init__(self, master):
self.master = Toplevel(master)
self.second = Button(self.master, text = "Third")
self.second.grid(row= 0, column = 0)
## The close button, not linked to any command
self.close = Button(self.master, text = "Close")
self.close.grid(row = 1, column = 0)
if __name__ == "__main__":
root = Tk()
first = First(root)
root.mainloop()
摧毀家長,但如何摧毀其他父母,如果有多個家長? – dsgdfg