-2
我想惡作劇我的朋友,做一個腳本,不斷顯示警告,並且是完全不可關閉的。到目前爲止我的代碼是:如何使tkinter在python中顯示多個警告,以及如何使python腳本不可關閉?
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窗口,當你啓動的程序打開。我怎樣才能抵消這一點?如果沒有解決方案,我該如何調整我的程序,以便它一次顯示一堆警告,使您的屏幕氾濫?