当我尝试使用winrt进行通知时,没有通知显示

问题描述

我正在尝试使winRT发送通知。我尝试这样做是为了发出通知

import winrt.windows.ui.notifications as notifications
import winrt.windows.data.xml.dom as dom

#create notifier
nManager = notifications.Toastnotificationmanager
notifier = nManager.create_toast_notifier("app-id");


tString = """
<toast>
    <visual>
        <binding template='ToastGeneric'>
            <text>Sample toast</text>
            <text>Sample content</text>
        </binding>
    </visual>
</toast>
"""

#convert notification to an XmlDocument
xDoc = dom.XmlDocument()
xDoc.load_xml(tString)

#display notification
notifier.show(notifications.ToastNotification(xDoc))

但是,当我运行它时,没有任何通知显示

我的系统符合winrt的要求

Windows 10,October 2018 Update or later.
Python for Windows,version 3.7 or later
pip,version 19 or later

如何显示通知?我不能使用其他模块,因为winrt是(我知道的)唯一的一种,您可以在其中创建通知等按钮的ui元素。我不认为Windows会阻止它显示,因为其他不符合我要求的模块会显示通知

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)