假如你想整蠱一下你朋友疾党,那你今天遇到我那就是緣分啦音诫!
直接用Python給你朋友上一課,直接幾行代碼就OK啦
直接上代碼:
import tkinteras 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='你就是個(gè)傻子雪位!',# 標(biāo)簽的文字
? ? ? ? ? ? bg='Red',# 背景顏色
? ? ? ? ? ? font=('楷體',17),# 字體和字體大小
? ? ? ? ? ? width=15,height=2? # 標(biāo)簽長寬
? ? ? ? ? ? ).pack()# 固定窗口位置
? ? window.mainloop()
threads = []
for iin range(100):# 需要的彈框數(shù)量
? ? t = threading.Thread(target=dow)
threads.append(t)
time.sleep(0.1)
threads[i].start()
效果圖
后面會(huì)繼續(xù)更新好玩的代碼竭钝,記得給我一個(gè)點(diǎn)個(gè)贊哦!當(dāng)然別忘了給個(gè)關(guān)注哦雹洗!