How to Send Windows 10 Toast Notifications using Python

Windows 10 Toast Notification is shown up at the bottom right corner. We can create a script to notify whenever we need it does by using win10toast package

win10toast is an easy-to-use Python library for displaying Windows 10 Toast Notifications which is useful for Windows GUI development.

Install win10toast #

pip install win10toast

win10toast depends on pywin32 so you have to install pywin32 as well

pip install pypiwin32

Example #

An example to show how to use win10toast to show the notification:

from win10toast import ToastNotifier
toaster = ToastNotifier()
toaster.show_toast("Hello World!!!",
                   "Python is 10 seconds awsm!",
                   icon_path="custom.ico",
                   duration=10)

toaster.show_toast("Example two",
                   "This notification is in it's own thread!",
                   icon_path=None,
                   duration=5,
                   threaded=True)
# Wait for threaded notification to finish
while toaster.notification_active(): time.sleep(0.1)

Tags:

Python