autumnn/randomalert.py

34 lines
842 B
Python

# -*- coding: utf-8 -*-
# @Version: Python 3.9
# @Time : 2022/4/26 13:35
# @Author : chenyinhua
# @File : randomalert.py
# @Software: PyCharm
# @Desc: windows弹窗傻狍子
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("260x50" + "+" + str(a) + "+" + str(b))
tk.Label(window, text="你是一个傻狍子", bg="green", font=("宋体", 17), width=150, height=40).pack()
window.mainloop()
threads = []
for i in range(100):
t = threading.Thread(target=boom)
threads.append(t)
time.sleep(0.1)
threads[i].start()