Sending Desktop Notifications in Python
Introduction
When building desktop applications, it becomes at one point needy to send your user(s) notifications. Be it to remind them of something, or pass through some useful information. When someone sends me a message on Discord for example, I am notified by the desktop application Clicking on the notification opens the app and brings me directly to the respective message.
In this article, I am going to expose the different ways I found to send desktop notifications using Python. You could the combine this with your python GUI application, made with Flet for example.
Sending Notifications
To send notifications in Python, we are going to make use of several python packages. Each of them have a specific area of application, meaning could be used on only specific Operating Systems. This is very good to know in order for your application not to break. Don’t worry, I will make all the necessary precisions :)
Before starting, I strongly advice/recommend you to first create a virtual environment (venv/virtualenv), so that all we do remains in a location isolated from the rest of your system instead of system-wide.
1.1 — using `Plyer`
Sending notifications using Plyer is platform-independent/cross-platform (possible on all desktop OSs). To be able to send notifications using it’s simple API, you will — obviously — have to install it. For that, use the following command:
pip install plyer
After successful installation, create a python file and paste in the sample code below:
import plyer
def notif_with_plyer(title: str, message: str):
"""
Sends a notification using the plyer engine.
Args:
title: str: the title of the notification
message: str: the message of the notification
Note:
Cross-Platform: could be used on any OS.
"""
plyer.notification.notify(
app_name="Plyer Notif",
title=title,
message=message,
app_icon="path/to/icon", # On Windows, the icon must have .ico extension
timeout=10, # For how long the notification should be shown
)
notif_with_plyer("Hello, Plyer!", "This is a very long description written by TheEthicalBoy.")
Run the program(make sure to take care of the paths) and have a look at the notification pop-up.

For more, give a look at it’s documentation here.
1.2 — using `notify-py`
Similar to Plyer, notify-py works on all desktop platforms. Install it using the command(notice the dash):
pip install notify-py
After successful installation, create a python file and paste in the sample code below:
import notifypy
def notif_with_notifpy(title: str, message: str):
"""
Sends a notification using the notif-py engine.
Args:
title: str: the title of the notification
message: str: the message of the notification
Note:
Cross-Platform: could be used on any OS.
"""
notification = notifypy.Notify(enable_logging=True) # I like enabling logging :)
notification.application_name = "Notify-py Notif"
notification.title = title
notification.message = message
notification.urgency = "critical" # 'low', 'normal' or 'critical'
notification.audio = "path/to/audio.wav"
notification.icon = "path/to/icon.png"
notification.send(block=False) # block=False spawns a separate thread inorder not to block the main app thread
notif_with_notifpy("Hello, Notify-Py!", "This is a very long description written by TheEthicalBoy.")
Run the program (make sure to take care of the paths) and have a look at the notification pop-up.

Feel free to have a look at it’s documentation.
1.3 — using `Pynotifier`
Similar to Plyer and Notify-py, Pynotifier also(trust me, this is the last one :) claims to work on all platforms.
Install it using the command (notice the dash):
pip install py-notifier
After successful installation, create a python file and paste in the sample code below:
import pynotifier
from pynotifier.backends import platform
def notif_with_pynotifier(title: str, message: str):
"""
Sends a notification using the pynotifier engine.
Args:
title: str: the title of the notification
message: str: the message of the notification
Note:
Cross-Platform: could be used on any OS.
"""
c = pynotifier.NotificationClient()
c.register_backend(platform.Backend())
notification = pynotifier.Notification(
title=title,
message=message,
icon_path="path/to/icon",
duration=10,
keep_alive=True, # keep toast alive in System Tray whether it was clicked or not
threaded=True # spawns a separate thread inorder not to block the main app thread
)
c.notify_all(notification)
notif_with_pynotifier("Hello, Pynotifier!", "This is a very long description written by TheEthicalBoy.")
Run the program (make sure to take care of the paths) and have a look at the notification pop-up.

1.4 — using `win10toast`
win10toast as you may have imagined, works only on the Windows OS — specifically version 10. Install it using the command:
pip install win10toast
After successful installation, create a python file and paste in the sample code below:
import win10toast
def notif_with_win10toast(title: str, message: str):
"""
Sends a notification using the win10toast engine.
Args:
title: str: the title of the notification
message: str: the message of the notification
Note:
Works only on the Windows OS.
"""
toaster = win10toast.ToastNotifier()
toaster.show_toast(
title=title,
msg=message,
icon_path="path/to/icon",
duration=10
)
notif_with_win10toast("Hello, Win10Toast!", "This is a very long description written by TheEthicalBoy.")
Run the program (make sure to take care of the paths) and have a look at the notification pop-up.

1.5 — using `win10toast_click`
Similar to win10toast, win10toast_click works only on the Windows OS. The main difference between these two lies in the word: ‘click’. Using win10toast_click, one can define a callback function which will be called when a desktop-user clicks on the notification banner/toast which showed-up. For example: on notification banner click, open a website.
Install it using the command:
pip install win10toast
After successful installation, create a python file and paste in the sample code below:
import win10toast_click
import webbrowser
def notif_with_win10toast_click(title: str, message: str):
"""
Sends a notification using the win10toast_click engine.
Args:
title: str: the title of the notification
message: str: the message of the notification
Note:
Works only on the Windows OS.
"""
def click_callback():
"""
Called/fired when the user clicks on the notification banner/toast.
Use it to run some other code block. Ex: open a web page
"""
try:
webbrowser.open("https://github.com/ndonkoHenri/Flet-Samples", autoraise=True)
except:
print('Failed to open URL :(')
toaster = win10toast_click.ToastNotifier() # initialize
# show up notification
toaster.show_toast(
title,
message,
icon_path="path/to/icon", # .ico image file
duration=10, # notification timeout; None = leave notification in Notification Center
threaded=True, # spawns a separate thread inorder not to block the main app thread; False = code execution waits till notification disappears
callback_on_click=click_callback # function to run when notification is clicked
)
notif_with_win10toast_click("Hello, Win10ToastClick!", "This is a very long description written by TheEthicalBoy.")
Run the program (make sure to take care of the paths) and have a look at the notification pop-up.

Click on the notification and a website will be opened in your default browser. :)
Conclusion
Depending on your needs and your OS target, choose the package that passes best. They are all easy and simple to use. In some lines of code you are good to go.
Nevertheless, win10toast_click has, I think, a great and very useful advantage on all the others: the possibility of running some code block (handling the event) on click of the notification. It’s disadvantage though is that it can only be run on Windows. :(
These 5 packages are those I found which worked. If I missed any other, please let me know so I could add it here.
Bonus
If you’ve read my previous articles, you certainly know of Flet(python framework to build Flutter apps). I built a simple desktop GUI application using this framework, where I combined all these packages. Here is the corresponding repository. The utils.py
file contains all functions shown above.

Hope the content of this article was interesting and could be of help.
By the way, I started a Youtube channel, please subscribe:
Thanks for reading. :)
In Plain English
Thank you for being a part of our community! Before you go:
- Be sure to clap and follow the writer! 👏
- You can find even more content at PlainEnglish.io 🚀
- Sign up for our free weekly newsletter. 🗞️
- Follow us: Twitter(X), LinkedIn, YouTube, Discord.
- Check out our other platforms: Stackademic, CoFeed, Venture.