Python 的 win10toast 模块未按预期工作
Python's win10toast module not working as intended
我一直在使用 python 的 win10toast 模块创建桌面通知作为我项目的一部分。
不过最近不太正常。
当我运行以下代码时:
import win10toast
toast = win10toast.ToastNotifier()
toast.show_toast("Python","Hello World",duration=10)
python 图标出现在任务栏中,但托盘中没有出现通知。
我尝试重新安装模块并将持续时间增加到 100 秒。还是不行。
非常感谢任何帮助。
这可能是因为 windows 10 行动中心的安静时间。
在右下角,单击“操作中心”图标。如果打开,请禁用“安静时间”设置。在您禁用“安静时间”后,可以显示 Toast 通知。
我在使用plyer时遇到了同样的问题。这是我的解决方案:
点击右下角的操作中心图标。点击 window 右上角的 'Manage Notifications' 文字。这将带您进入设置页面。在这里,确保 'Get Notifications from other apps and other senders' 已打开。
我发现问题只出在 win10toast 上。于是换成plyer就没问题了
我在 windows 更新后遇到了这个问题。
问题是 python 没有出现在列表 'Get notifications from these senders' in 'notification and actions settings'.
中
解决步骤:
- 运行:
from win10toast import ToastNotifier
toaster = ToastNotifier()
toaster.show_toast("title",'content', threaded=False, icon_path=None, duration=60)
- 快速打开'Notifications and actions settings'。 'Get notifications from these senders' 下的列表将刷新并包括 'Python'.
- 现在您可以取消通知静音了。
如果这不能解决问题,plyer 是一个很好的选择。
我一直在使用 python 的 win10toast 模块创建桌面通知作为我项目的一部分。
不过最近不太正常。
当我运行以下代码时:
import win10toast
toast = win10toast.ToastNotifier()
toast.show_toast("Python","Hello World",duration=10)
python 图标出现在任务栏中,但托盘中没有出现通知。 我尝试重新安装模块并将持续时间增加到 100 秒。还是不行。
非常感谢任何帮助。
这可能是因为 windows 10 行动中心的安静时间。
在右下角,单击“操作中心”图标。如果打开,请禁用“安静时间”设置。在您禁用“安静时间”后,可以显示 Toast 通知。
我在使用plyer时遇到了同样的问题。这是我的解决方案:
点击右下角的操作中心图标。点击 window 右上角的 'Manage Notifications' 文字。这将带您进入设置页面。在这里,确保 'Get Notifications from other apps and other senders' 已打开。
我发现问题只出在 win10toast 上。于是换成plyer就没问题了
我在 windows 更新后遇到了这个问题。 问题是 python 没有出现在列表 'Get notifications from these senders' in 'notification and actions settings'.
中解决步骤:
- 运行:
from win10toast import ToastNotifier
toaster = ToastNotifier()
toaster.show_toast("title",'content', threaded=False, icon_path=None, duration=60)
- 快速打开'Notifications and actions settings'。 'Get notifications from these senders' 下的列表将刷新并包括 'Python'.
- 现在您可以取消通知静音了。
如果这不能解决问题,plyer 是一个很好的选择。