A simple Python library that simplifies the sending of desktop notifications!
Project description
What is that?
Notifier (pynotifier) is a Python library that allows you to easily send desktop notifications.
This project originally came from https://github.com/ms7m/notify-py (huge thanks), but we decided to fork this project, actively maintain it and add more features.
Supported Platforms
- Windows 10/11
- Windows 8.1 (Balloon tips)
- macOS 10 >=10.10
- Linux (libnotify)
Windows 7 | Windows 8.1 | Windows 10 | Windows 11 | Linux | macOS 10 >=10.10 |
---|---|---|---|---|---|
❓ | ✅ (Balloon tips) |
✅ (Toast notification) |
✅ (Toast notification) |
✅ (requires libnotify) |
✅ (No custom icon) |
Installation
You can install notifier with pip
pip install notifier.py
Usage
Send Simple Notification
from notifier import Notifier
notifier = Notifier()
notifier.title = "Some title"
notifier.message = "Some message"
notifier.send()
Send Notification With Icon
from notifier import Notifier
notifier = Notifier()
notifier.title = "Some title"
notifier.message = "Some message"
notifier.icon = "path/to/icon.png" # .png is not supported under windows 8.1
notifier.send()
Send Notification With Sound
from notifier import Notifier
notifier = Notifier()
notifier.title = "Some title"
notifier.message = "Some message"
notifier.audio = "path/to/audio/file.wav" # we currently only support wav files
notifier.send()
Sending with Default Notification Titles/Messages/Icons
from notifier import Notifier
notifier = Notifier(
default_notification_title="Function Message",
default_application_name="Great Application",
default_notification_icon="path/to/icon.png",
default_notification_audio="path/to/sound.wav"
)
def your_function():
# stuff happening here.
notifier.message = "Function Result"
notifier.send()
Disabling Windows Version Detection
from notifier import Notifier
notifier = Notifier(override_windows_version_detection=True)
notifier.title = "Some title"
notifier.message = "Some message"
notifier.send()
Changing Windows Override Version
from notifier import Notifier
notifier = Notifier(override_windows_version="8.1") # Available values: 10, 8.1
notifier.title = "Some title"
notifier.message = "Some message"
notifier.send()
Inspiration and Special Thanks
- Thanks to ms7m for creating https://github.com/ms7m/notify-py
- Also thanks to jithurjacob for creating https://github.com/jithurjacob/Windows-10-Toast-Notifications (a modified version has been added to this repository to fix bugs)
Side notes
- macOS does not support custom icons on the fly.. You will need to bundle a customized version of the notifier embedded with your custom icon.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
notifier.py-0.4.6.tar.gz
(176.5 kB
view hashes)
Built Distribution
notifier.py-0.4.6-py3-none-any.whl
(179.2 kB
view hashes)
Close
Hashes for notifier.py-0.4.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 239599b7448ac3d1edfff83fcef20281297189673a68bca1b7ae81269b269e1d |
|
MD5 | 7f93fe54ea7da424529ac3eadacbe428 |
|
BLAKE2b-256 | 7a07b7960370b0a42fb98d4959008b7e7fae49e6f16876133e9338566e4c5715 |