
def dow(): t = () width = t.winfo_screenwidth() height = t.winfo_screenheight() a = random.randrange(0, width) b = random.randrange(0, height) t.title('端午安康') t.geometry('200x50' + '+' + str(a) + '+' + str(b)) tk.Label(t, text='端午安康!', bg='Green', # 背景色 font=('楷体', 17), # 字体和字体大小 width=15, height=2 # 标签长宽 ).pack() t.mainloop() threads = [] for i in range(10): # 需要的弹框数量 t = threading.Thread(target=dow) threads.append(t) time.sleep(0.1) threads[i].start()
看一下效果:


















