I am trying to make winRT send notifications. I tried doing this to make a notification:
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();
#define your notification as string
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))
Hoever, it returns this error, when i try to run it.
notifier = notifications.ToastNotificationManager.create_toast_notifier()
RuntimeError: Element not found.
My system meets the requierments of winrt
Windows 10, October 2018 Update or later.
Python for Windows, version 3.7 or later
pip, version 19 or later
How do i fix this error? I can not use other modules, because winrt is the olny one (that I know of) where you can create ui elements on the notification such as buttons.