首先,你需要一台电脑,一个python,就好了,废话不多说,上代码
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='你就是个傻子!',# 标签的文字
bg='Red',# 背景颜色
font=('楷体',17),# 字体和字体大小
width=15,height=2 # 标签长宽
).pack()# 固定窗口位置
window.mainloop()
threads = []
for iin range(100):# 需要的弹框数量
t = threading.Thread(target=dow)
threads.append(t)
time.sleep(0.1)
threads[i].start()
好了,拿去吧,不过如果你的朋友没有Python的话,那你可以打包一下再发过去,应该都会打包吧(什么?不会好吧,那我演示一下吧)
首先,我们需要用pip指令,首先打开一个cmd窗口,输入pip install pyinstaller,等一会就好了,接下来,pyinstaller -F -w -i python.ico Hello_world.py(.py前的是你要打包的文件名)等一会,你未打包的文件上面会出现三个文件夹,dist文件夹里就会有一个Hello_world.exe,双击就可以运行了
---------------------------------------------分割线-------------------------------------------------也可以输入指令pip install auto-py-to-exe,安装好后,输入auto-py-to-exe来运行,
接下来就会显示这个??
接下来在这?
输入文件的具体位置,再按一下那个蓝色的按键,等一会就好了
(本人建议用第二种方法)
好嘞,把打包好的文件发给你那个朋友吧!