jithurjacob / Windows-10-Toast-Notifications

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

Multiple threaded notifications don't show #30

Closed cowsay652 closed 6 years ago

cowsay652 commented 6 years ago

In the following code:

from win10toast import ToastNotifier
from time import sleep

notify = ToastNotifier()

notify.show_toast("Testing!", "Hopefully the test goes well...", "info.ico", 10, True)
sleep(4)
notify.show_toast("Testing! #2", "Hopefully the test goes well... (again)", "info.ico", 10, True)
print("End")

Only the first notification shows, and then goes straight to printing "End", without showing the second notification.

I am using Python 3.5.4 and Windows 10 Home Fall Creators Update (1709).

jithurjacob commented 6 years ago

Hi, as of now this is the expected behavior. While one notification is active the second one won't be triggered. If needed you can reduce the duration of the first toast. Setting the duration of first toast as 3 seconds and this would work fine.

jithurjacob commented 6 years ago

@BroderickCarlin is there any way we queue the second the toast notification? https://github.com/jithurjacob/Windows-10-Toast-Notifications/blob/9d52b73f1af6c60162cf09b99269c4f7b13cdb00/win10toast/__init__.py#L129

cowsay652 commented 6 years ago

Thanks for letting me know - I'll use your solution for the time being. :)

BroderickCarlin commented 6 years ago

It would be possible to add a queue system but that adds a lot of other design considerations like would you need the ability to remove notifications from the queue or check if they exist in the queue. For the time being I recommend just trying not to spam the system, and in fact you can check the return value of the show_toast method to see if the notification was successfully shown.

jithurjacob commented 6 years ago

@BroderickCarlin yes I agree with you. Closing the issue.