jithurjacob / Windows-10-Toast-Notifications

Python library to display Windows 10 Toast Notifications
MIT License
964 stars 168 forks source link

how to storage notifications into Action center #76

Open lukifer195 opened 3 years ago

lukifer195 commented 3 years ago

It is interesting feature I want to keep it

maxwill-max commented 3 years ago

I am using this. It works perfectly and can hold notifications in notification/action center until you clear them 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
notifier = ToastNotificationManager.create_toast_notifier(r'C:\Users\HP\AppData\Local\Programs\Python\Python38\python.exe')

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))
lukifer195 commented 2 years ago

I am using this. It works perfectly and can hold notifications in notification/action center until you clear them 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
notifier = ToastNotificationManager.create_toast_notifier(r'C:\Users\HP\AppData\Local\Programs\Python\Python38\python.exe')

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))

yah this well working although some confuse with XML language , how can I create time duration or icon bro? Thank you bro