from win10toast import ToastNotifier # 导入系统通知对象
import time # 系统时间模块
import datetime
from threading import Timer # 定时器
初始化通知调用对象
notify = ToastNotifier() # 初始化系统通知对象
初始化windows通知相关的参数,设置定时通知间隔时间等。
notify_head = ‘主人,来通知啦!’
notify_min = 1.0
notify_text = ‘已经过了’ + str(int(notify_min)) + ‘分钟了,该喝水了!’
notify_sen = notify_min * 1
通知调起时,是使用win10toast的show_toast()函数,参数和定义如下面。
‘’’
def show_toast(self, title=“Notification”, msg=“Here comes the message”,
icon_path=None, duration=5, threaded=False):
“”"Notification settings.
:title: notification title
:msg: notification message
:icon_path: path to the .ico file to custom notification
:duration: delay in seconds before notification self-destruction
“”"
‘’’
show_toast()函数