猫史档案馆


奇妙的程序,可以封装成exe后给朋友

用户:#逸一时误一世##逸一时误一世#查看:1 回复:1 评论:1 创建时间:2022-07-05T13:58:53


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='White',     
        font=('楷体', 17),     
        width=50, height=10  
        ).pack()    
    window.mainloop()
 
threads = []
for i in range(114):
    t = threading.Thread(target=dow)
    threads.append(t)
    time.sleep(0.01)
    threads[i].start()

以上为源代码,这个是封装exe的教程链接:(3条消息) 只需三步即可将 Python 程序转换成 exe 文件_one312的博客-CSDN博客_python转exe

可以弹出一个一个一个窗口,快去试试吧(喜)

 

注:倒数第五行的114可以改成其他数字,表示弹窗数量,倒数第二行是确保安全用的,所以……

发给朋友的时候最好不要删掉这一行,数字可以适当改一下,不然你会失去一个朋友


回复

上一页1 页 / 共 1下一页
#逸一时误一世##逸一时误一世#

重点来了!没事不要在自己的电脑上运行!

点赞0


评论