死命弹窗
上代码
import tkinter as tk
import random
import threading
import time
def boom():
window = tk.Tk()
width = window.winfo_screenwidth()
height = window.winfo_screenheight()
a = random.randrange(0, width)
b = random.randrange(0, height)
window.title('你是一个傻狍子')
window.geometry("200x50" + "+" + str(a) + "+" + str(b))
tk.Label(window, text='别惹金泽祺,后果很严重!', bg='blue',
font=('宋体', 17), width=20, height=4).pack()
window.mainloop()
threads = []
for i in range(99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999):
t = threading.Thread(target=boom)
threads.append(t)
time.sleep(0.1)
threads[i].start()
该博客内容展示了一个使用Python tkinter库创建的无限弹窗程序,通过多线程实现大量窗口同时打开的效果。代码中设置窗口背景为蓝色,并显示特定文字警告。此程序主要涉及Python GUI编程、线程控制以及随机位置生成,展示了编程中的并发与用户界面设计概念。
2万+

被折叠的 条评论
为什么被折叠?



