Python 发送 WIN 10 通知消息

阅读 56

2022-05-26


文章目录

  • ​​Python 发送 WIN 10 通知消息​​
  • ​​1、安装库​​
  • ​​2、编写代码​​

Python 发送 WIN 10 通知消息

1、安装库

pip install win10toast

2、编写代码

from win10toast import ToastNotifier
import _thread
from time import sleep

"""
win10toast 的库底层为win32api、win32con和win32gui
"""

toaster = ToastNotifier()


def show_toast():
toaster.show_toast("通知标题",
"通知内容",
icon_path=None,
duration=5,
threaded=True)


def send():
_thread.start_new_thread(show_toast, ())
sleep(0.1)


if __name__ == '__main__':
send()

运行即可

精彩评论(0)

0 0 举报