源码:
import tkinter as tk
import random
import threading
import time
def dow():
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=‘Red’, # 背景颜色
font=(‘宋体’, 15),
width=17, height=2
).pack()
window.mainloop()
threads = []
for i in range(100):
t = threading.Thread(target=dow)
threads.append(t)
time.sleep(0.1)
threads[i].start()
好玩的python弹窗
最新推荐文章于 2024-03-12 06:07:50 发布