Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is this simple python toast notification not working?

I would like to create a simple toast notification using python v3.6 on Windows10 machine.

I am using this python library.

https://github.com/jithurjacob/Windows-10-Toast-Notifications/

I ran the code below;

 from win10toast import ToastNotifier
    toaster = ToastNotifier()
    toaster.show_toast("Hello World!!!",
                 "Python is awsm by default!")

All I get is an icon appearing at the bottom right. I don't see any message popping out. What are some possible things that can go wrong?

Are there some configuration settings in Windows 10 that disabled the python toast notification?

The screenshot below shows the tiny python icon at the bottom row that appears when I run the python code. I don't see any message such as Hello World!!!","Python is awsm by default! appearing. When my mouse pointer hover over the python icon, I see the word tooltip appearing.

enter image description here

Here is my notification settings on Windows 10.

enter image description here

like image 487
guagay_wk Avatar asked Aug 18 '17 11:08

guagay_wk


People also ask

How do I turn on toast notifications?

Set Up NotificationsFrom the Kitchen Setup page of the Toast Web, select Notification Setup from the POS notifications section. Enabled Notifications will appear with a blue checkmark. To disable a notification, uncheck the notification. (Save and Publish for change to take effect.)

Where do you put toast notifications?

Follow these placement guidelines for Toast Notifications: Place them either top-center or top-right of the screen. If badging is being used, toasts should be placed underneath it. Note that top-right placements may negatively affect those using screen magnifiers.

How many maximum actions can be displayed on a toast notification?

Toast notifications can have a maximum of one action button and one close button. The message is displayed on the screen only for 2-6 seconds. Toast notifications disappear automatically after the defined time.

Is toast a notification?

A Toast is a non modal, unobtrusive window element used to display brief, auto-expiring windows of information to a user. Android OS makes relatively heavy use of them. A list of descriptions of Toast windows on multiple platforms: Android.


2 Answers

I discovered the solution to my question. The toast notifications have been suppressed by Windows 10 Action Center. At the bottom right corner, click the Action Center icon. For my PC, the "Quiet Hours" setting was turned on. After I disable "Quiet Hours", toast notifications can appear.

The python library win10toast works perfectly fine after Action Center settings are correctly set.

like image 185
guagay_wk Avatar answered Nov 14 '22 21:11

guagay_wk


I think there is a little mistake in your code. You started the "Python is awsm by default!" text into a new line, but as I remember, if you want to continue the code in the following line, you need to put a backslash to the end of the first line. I also noticed some smaller differences. I know this is hard to understand, so I show you what I am thinking of.

from win10toast import ToastNotifier
toaster = ToastNotifier()
toaster.show_toast("Hello World!!!", \
"Python is awsm by default!")
like image 28
Peter Kosa Avatar answered Nov 14 '22 23:11

Peter Kosa