如何使 tkinter 在 python 中显示多个警告,以及如何使 python 脚本无法关闭?

How to make tkinter show multiple warnings in python, and how to make a python script uncloseable?

我想恶作剧我的朋友们,通过制作一个脚本,不断显示警告,并且完全无法关闭。到目前为止我的代码是:

import tkinter as tk
from tkinter import messagebox
import random
root = tk.Tk()

messages=["Anodr settlument neds yer hulp!","Another settlement needs your help!",
          "Settlument another help needs!","Need hulp settlement!","Anuthr settlumet neeedl yur halp!"]

def on_closing():
    pass

root.protocol("WM_DELETE_WINDOW", on_closing)

while True(5):
    messagebox.showwarning("Prstn",messages[random.randint(0,4)])

root.mainloop()

问题是,这仍然可以关闭,如果您关闭 CMD window,它会在您启动程序时打开。我该如何应对呢?如果没有解决方案,我该如何调整我的程序,以便它立即显示一堆警告,淹没你的屏幕?

将消息变成问题,然后继续问愚蠢的问题...不过不推荐,他们可能不再是你的朋友了。

yn = tkMessageBox.askyesno("Text", "Ask a question...")
if yn == True:
    yn = tkMessageBox.askyesno("Text", "Ask another question...")
    if yn == True:
        yn = tkMessageBox.askyesno("Text", "Ask another question...")
        ...
        ...
else:
    yn = tkMessageBox.askyesno("Text", "Ask another question...")
    if yn == True:
        yn = tkMessageBox.askyesno("Text", "Ask another question...")
    else:
        ...
        ...