整蛊朋友的python代码{1}(二次创作)

死命弹窗

上代码

 

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()

重点摘要解释

1,单引号内的内容可编辑

2,bg='blue' 背景颜色设置

3,看到那么多9了吗?是弹窗的个数!

你可能感兴趣的:(python)