Skip to content
forked from malja/zroya

Python wrapper of win32 for creating Windows notifications.

License

Notifications You must be signed in to change notification settings

vault-the/zroya

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: MIT Documentation Status PyPI version PyPI status Maintenance

zroya

Zroya is python wrapper around win32 API for creating Windows notification. See Read The Docs documentation.

Prerequisites

Zroya requires you to install pypiwin32.

> pip install pypiwin32

Installation

Zroya is available from pypi:

> pip install zroya

Example

# 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()

In action

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)

Info notification

NotificationCenter.ICON_WARNING

nc.create("Warning notification", "This is warning notification.\nClick on me for sure!", icon=NotificationCenter.ICON_WARNING)

Warning notification

NotificationCenter.ICON_ERROR

nc.create("Error", "This is error notification.\nDo not click me, you would find out!", icon=NotificationCenter.ICON_ERROR)

Error notification

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: Windows 10 notification center example

About

Python wrapper of win32 for creating Windows notifications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%