Zroya is python wrapper around win32 API for creating Windows notification. See Read The Docs documentation.
Zroya requires you to install pypiwin32
.
> pip install pypiwin32
Zroya is available from pypi:
> pip install zroya
# Import NotificationCenter
from zroya import NotificationCenter
quit = False
# This function is called when user clicks on notification
def click_callback(nid, data):
global quit
print("User clicked on your notification!")
quit = True
# Create instance of NotificationCenter
nc = NotificationCenter()
# Create new notification
nc.create("Test Notification", "Longer notification description. \n With multiline support!", on_click = click_callback)
# Update function should be called in your event loop. In this example, we will create our own event loop:
while nc.update():
if quit:
nc.quit()
You may use one for three predefined notification types:
NotificationCenter.ICON_INFO
nc.create("Info notification", "This is informative notification.\nClick on me!", icon=NotificationCenter.ICON_INFO)
NotificationCenter.ICON_WARNING
nc.create("Warning notification", "This is warning notification.\nClick on me for sure!", icon=NotificationCenter.ICON_WARNING)
NotificationCenter.ICON_ERROR
nc.create("Error", "This is error notification.\nDo not click me, you would find out!", icon=NotificationCenter.ICON_ERROR)
Custom icon
Or pass an absolute path to .ICO file as icon
parameter and use whatever icon you like.
Notification center
All notifications are automatically added to Windows 10 notification center after timeout: