jithurjacob / Windows-10-Toast-Notifications

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

The notifications don't work in the latest update of Windows 10 #39

Open sunnyville opened 5 years ago

sunnyville commented 5 years ago

Hi,

I've been using this library for a long time and never had any problems. Recently I let Windows update with it's latest update, and right after that I stopped getting notification from my program. I tested this by creating a simple python file with only the sample code of this library and again the notification didn't popup. I noticed whenever the notification was supposed to popup it will only show an icon in the system tray and not show the notification.

I suspect this has to do with Windows' feature of "Focus Assist" that I only noticed recently. I also noticed that there is a white-list of programs in the "Notifications & Actions" section of Settings, where you can enable or disable notifications from certain programs and sources, which I'm not sure was there before.

Would really appreciate a feedback on this as this library is very crucial for my application.

Thank you.

lukeclopez commented 5 years ago

Try this:

  1. Open settings with Windows Key + i
  2. Navigate to Privacy > Background Apps
  3. Toggle on Let apps run in the background and then Reboot your computer. However, if it is already toggled on, toggle it off, and then turn it back on.

Solution from: https://www.thewindowsclub.com/notifications-missing-from-action-center

Hope this helps.

maxwill-max commented 3 years ago

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 or make python listen for the click event It is supported by MS and can work in lastest update 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))