python调用windows弹窗

python调用windows弹窗

python 复制代码
import win32api
import _thread  # 引入线程的模块   比较老的模块  新的 threading

def run(i):
    win32api.MessageBox(0, "您的{}号大宝贝上线了".format(i), "来自小莹的问候", 2)

for i in range(5):
    _thread.start_new_thread(run, (i,))  # 发起多个线程  传参的情况  参数为元组
    # _thread.start_new_thread(run,()) #发起多个线程  不传参 页需要俩个参数 第二个为空元组
print('会先执行我')
# 如果主线程 不死  那么 所有的次线程 就都会正常执行
while True:
    pass

运行结果:

相关推荐
mg6682 分钟前
0基础开发学习python工具_____一键打包!用 PyInstaller 将 Python 烟花程序转为 .exe(无需 Python 环境)
开发语言·python
1024小神5 分钟前
cloudflare中wrangler支持的d1等命令有哪些
开发语言
helloworld也报错?6 分钟前
目标检测系列之YOLOv11——v8模型的继续改进
人工智能·python·目标检测·目标跟踪
ray96335 分钟前
Python——函数参数传递方式
开发语言·python
BullSmall37 分钟前
Socket中断原因与处理全攻略
开发语言
十五年专注C++开发37 分钟前
浅谈Qt中的QSql模块整体设计
开发语言·数据库·c++·qt
codists39 分钟前
2025年12月文章一览
python
梅羽落41 分钟前
python武器化开发_01
开发语言·python·php
Joe_Blue_021 小时前
Matlab 入门案例介绍——如何创建脚本
开发语言·matlab·matlab 入门案例