Windows-10-Toast-Notifications icon indicating copy to clipboard operation
Windows-10-Toast-Notifications copied to clipboard

how to load from xml

Open adhirmndl opened this issue 5 years ago • 4 comments

adhirmndl avatar Sep 01 '18 10:09 adhirmndl

asdasd

adhirmndl avatar Sep 01 '18 10:09 adhirmndl

Do you mean for your title: New Feature: Add support Toast Schema ? (as described in https://docs.microsoft.com/en-us/uwp/schemas/tiles/toastschema/schema-root)

jfthuong avatar Nov 03 '20 01:11 jfthuong

@jfthuong I guess so. Is there a solution?

ZhangTianrong avatar Jan 31 '21 07:01 ZhangTianrong

I am using this. It works perfectly. You can assign any string to appid, that would become the name of the notifications but I can't seem to figure out how to clear out the notifications automatically or make python listen for the click event refer https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/toast-ux-guidance

from winrt.windows.ui.notifications import ToastNotificationManager, ToastNotification
import winrt.windows.data.xml.dom as dom
appid=r'C:\Users\HP\AppData\Local\Programs\Python\Python38\python.exe'
notifier = ToastNotificationManager.create_toast_notifier(appid)

tString = """<toast duration='short'><audio src  = 'ms-winsoundevent:Notification.Reminder' loop = 'false' silent = 'false'/><visual><binding template='ToastText02'><text id="1">""" + title + """</text><text id="2">""" + desp + """</text></binding></visual></toast>"""

xDoc = dom.XmlDocument()
xDoc.load_xml(tString)
notifier.show(ToastNotification(xDoc))

maxwill-max avatar Mar 24 '21 21:03 maxwill-max