6

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

guagay_wk
  • 26,337
  • 54
  • 186
  • 295
  • 1
    Could you share a screen capture of what you are saying? – Adonis Aug 18 '17 at 11:41
  • 3
    Hi I'm the author of this library could you please share a screenshot? – Jithu R Jacob Aug 18 '17 at 12:33
  • @Jithu R Jacob, it is an honour to see you on my question. I'm sure it is my fault but I don't know what went wrong. I have attached a sceenshot to my question. – guagay_wk Aug 18 '17 at 12:48
  • 1
    Can you please confirm if notifications are enabled in your system? http://www.thewindowsclub.com/toast-notifications-windows-8 – Jithu R Jacob Aug 18 '17 at 13:01
  • @Jithu R Jacob, I attached my notification settings on Windows 10. – guagay_wk Aug 18 '17 at 13:12
  • @user781486 IAre you trying to implement this in PyQt? Could you please open a new cmd and try the sample code? – Jithu R Jacob Aug 18 '17 at 15:24
  • @Jithu R Jacob, do you have a new sample code? The code I am using is from your win10toast project. I don't know about PyQt. I am using relying on win10toast library only. – guagay_wk Aug 18 '17 at 15:43
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/152270/discussion-between-jithu-r-jacob-and-user781486). – Jithu R Jacob Aug 18 '17 at 15:45
  • @Jithu R Jacob, I am using anaconda python package. I am wondering if that can be the cause. I will verify it and if there are positive results, I will post here. I am not able to get another working PC to test the sample code. For some reasons, I cannot get win10toast installed successfully on the other PC. – guagay_wk Aug 22 '17 at 03:56
  • @Jithu R Jacob, I just got the other PC working and tested your win10toast successfully. THere are some installation problems on my first PC that cause win10toast to work partially. If I find out the cause, I will post an answer to my own question. Thank you for your help. – guagay_wk Aug 22 '17 at 04:06
  • 1
    @user781486 thank you – Jithu R Jacob Aug 22 '17 at 05:35
  • @Jithu R Jacob, I discovered the solution. It has something to do with the Action Centre settings. Please see my answer. Your win10toast works perfectly well. – guagay_wk Aug 22 '17 at 07:00

4 Answers4

14

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.

guagay_wk
  • 26,337
  • 54
  • 186
  • 295
2

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!")
novc
  • 29
  • 1
0

go to bottom right, click action center, now click at the top right corner where it says manage notifications, now enable the button under the title 'Notifications' if it is disabled and probably because of this reason win10toast was unable to perform the desired task. and now it works absolutely! :) Thank you!

raiyan22
  • 1,043
  • 10
  • 20
0

plyer (for creating notifications on your PC)

   pip install plyer

creating custom notification

from plyer import notification #for getting notification on your PC
notification.notify(
        #title of the notification,
        title = "COVID19 Stats",
        #the body of the notification
        message = "Total cases :",  
        #creating icon for the notification
        #we need to download a icon of ico file format
        app_icon = "Paomedia-Small-N-Flat-Bell.ico",
        # the notification stays for 50sec
        timeout  = 50
    )