|  | 
 
| 
本帖最后由 Wirror 于 2021-7-11 14:04 编辑
x
马上注册,结交更多好友,享用更多功能^_^您需要 登录 才可以下载或查看,没有账号?立即注册  
 people窗口关闭后显示top没有定义,但是top只是withdraw了
 Exception in Tkinter callback
 Traceback (most recent call last):
 File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\tkinter\__init__.py", line 1883, in __call__
 return self.func(*args)
 File "G:\login.py", line 85, in show
 top.update()
 NameError: name 'top' is not defined
 #### b.py中的函数 ####
 
 复制代码from b import *
class Application1(Application_ui):
    #这个类实现具体的事件处理回调函数。界面生成代码在Application_ui中。
    def __init__(self, master=None):
        Application_ui.__init__(self, master)
    def set_Cmd(self, event=None):
        top.withdraw()
        people_set()
    def show(self, event=None):
        top.update()
        top.deiconify()
if __name__ == "__main__":
    top = Tk()
    Application1(top).mainloop()
 
 
 #### b.py中的函数 ####
 
 复制代码from a import *
def people_set():
    people = Tk()
    people.protocol('WM_DELETE_WINDOW', Application1().show)
    Application(people).mainloop()
 
 
 
 | 
 |