我试图通过使用列表和简单的输入和输出错误来制作一个简单的通知提醒,为此,我使用了以下代码,期望在给定的相应时间之后收到通知,但是,代码没有这样做,而是在第一次通知后的标题。
myschedule = []
def func():
import schedule
import time
import win10toast
noti=win10toast.ToastNotifier()
choice="yes"
while choice=="yes":
title=input("enter the title")
message=input("enter the message")
tim=input("enter the time")
ms=[title,message,tim]
myschedule.append(ms)
choice = input("enter your choice:")
if choice == "yes":
title = input("enter the title")
message = input("enter the message")
tim = input("enter the time")
ms = [title, message, tim]
myschedule.append(ms)
choice = input("enter your choice:")
else:
pass
for i in myschedule:
def functionmaker():
noti.show_toast(i[0],i[1],duration=12)
schedule.every().day.at(i[2]).do(functionmaker)
while True:
schedule.run_pending()
func()
我也遇到过这个错误消息。查看 github 页面上的问题,如果发现以下内容:
https://github.com/jithurjacob/Windows-10-Toast-Notifications/issues/112
虽然它标有 python 3.11,但我使用 python 3.8 也会出现这种情况。 有一个简单的解决方案,已被请求合并到项目中,但上周才获得批准。请参阅此链接:https://github.com/jithurjacob/Windows-10-Toast-Notifications/pull/115/files/65d312f6015e9f01219fffdd376033eb5c4d5fce
由于错误消息不会阻止代码执行(至少在我的情况下),您可以暂时保留它,等待最新版本中实现更改。
作为临时修复,您可以自己更改包代码。
编辑:我注意到 git 存储库自 2018 年以来没有新的提交,因此这些更改似乎不太可能很快反映在版本中。
从系统设置中打开您正在使用的口译员的通知。为我工作:)