jithurjacob / Windows-10-Toast-Notifications

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

Keep notification after excecution #83

Open ghost opened 3 years ago

ghost commented 3 years ago

is there a way that when the program executes to keep the notification in the system tray rather than having it disappear? thank you.

pssolanki111 commented 3 years ago

+1 for opening up this question. I wanted to know if we can like keep the toast on the screen (to the bottom right of course) and perhaps update the data in there if needed?

gozeloglu commented 3 years ago

It would be a nice feature. I'd like to see the notification on the notification history.

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

Also need this. Would be really useful.