简体   繁体   中英

How to re-enable notifications for python after disabling it in windows?

I made a simple python program to show a system notification and I decided to disable notifications for python for some time and enable it again afterwards in Windows settings > System > Notifications & Actions, however python was not in the list of apps that show notifications.

HOW DO I ENABLE IT AGAIN?

Is possible to do it with the code itself or with command prompt or by any other means?

Code:

from win10toast import ToastNotifier
notif = ToastNotifier()
notif.show_toast("ALERT", "TEST1", icon_path="C:/Windows/SystemApps/Microsoft.Windows.SecHealthUI_cw5n1h2txyewy/Assets/Device.contrast-white.ico", duration=5)

6 Steps to solve this problem:

1 - Open both Settings > System > Notifications & Actions and wherever you run your program (Example - Terminal or IDE)


2 - Increase the time of the notification to be shown by python to a large number like 50 seconds, by changing the duration argument in *.show_toast()


3 - Run your script and quickly refresh the app list found in the Settings window you opened in step 1 by going to another tab such as Sound and coming back to the previous tab


4 - Now that your program is running and trying to display a notification, Python will be added to the list in until the time duration is elapsed, quickly turn on Python just like how you would for any other app.


5 - Close settings and terminate your script.


6 - Run your script again and the notification you were trying to display should now come as usual.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM