Wirror 发表于 2021-7-10 11:18:46

Twilight6 发表于 2021-7-10 11:06
把你之前代码最后改成这样试试看:

哇,还有这种语句啊,吧函数里的局部变量变成全局了
但是窗口还是没有关掉{:10_266:}
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 "C:\Users\Administrator\PycharmProjects\pythonProject\管理软件\ruler.py", line 62, in Command1_Cmd
    ruler_window.destroy()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\tkinter\__init__.py", line 2303, in destroy
    self.tk.call('destroy', self._w)
_tkinter.TclError: can't invoke "destroy" command: application has been destroyed
感觉离成功不远了{:5_109:}

Wirror 发表于 2021-7-10 11:26:32

Twilight6 发表于 2021-7-10 11:06
把你之前代码最后改成这样试试看:

OK了,窗口关掉了,谢谢大佬{:10_282:}

Twilight6 发表于 2021-7-10 11:48:37

Wirror 发表于 2021-7-10 11:26
OK了,窗口关掉了,谢谢大佬



哈哈,加油~

页: 1 [2]
查看完整版本: tkinter: 函数中Tk()一个对象为什么在Application类中不能quit()?好像是作用域的问题