+-
python-使用tkinter的不可关闭的窗口
嘿,当我输入错误的密码时,我正在制作一个使用网络摄像头拍照的程序.该程序将打开,我希望它无法关闭.
我需要知道如何使用tkinter使窗口无法关闭.
最佳答案
您可以尝试@abarnert建议的所有方法,但是我认为最简单的方法就是忽略close事件.

从this question开始:

Here you have a concrete example:

import Tkinter as tk
import tkMessageBox as messagebox
root = tk.Tk()

def on_closing():
    if messagebox.askokcancel("Quit", "Do you want to quit?"):
        root.destroy()

root.protocol("WM_DELETE_WINDOW", on_closing)
root.mainloop()

(Windows的已编辑代码)

因此将on_closing()更改为
def on_closing():
    通过
这使得它无法关闭.我尝试使用Alt F4(关闭按钮),从Windows任务栏将其关闭,但都无济于事.我能够杀死它的唯一方法是使用任务管理器.

点击查看更多相关文章

转载注明原文:python-使用tkinter的不可关闭的窗口 - 乐贴网