Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kivy-garden/garden.notification
:name_badge: A floating popup-like notification
https://github.com/kivy-garden/garden.notification
Last synced: about 1 month ago
JSON representation
:name_badge: A floating popup-like notification
- Host: GitHub
- URL: https://github.com/kivy-garden/garden.notification
- Owner: kivy-garden
- License: mit
- Created: 2017-01-11T22:19:49.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-12-08T03:17:40.000Z (about 5 years ago)
- Last Synced: 2023-03-30T18:26:25.053Z (over 1 year ago)
- Language: Python
- Size: 137 KB
- Stars: 11
- Watchers: 10
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# garden.notification
:name_badge: A floating popup-like notificationThis widget provides a browser-like
notification with all of the basic Kivy features available. You can use it
either in its default state, where is only basic title and message with some of
the color configuration, or you can input your own message layout in kv
language. The message string is available through ``app.message`` property.
For more such properties, read the code.## Features:
- message scrolls
- available icon option
- title will be shortened if too long
- callback after the notification disappears
- stacking multiple notifs on top of each other
- markup turned on in title and message by default
- kv language input
- positioning and stacking relatively to the taskbar (Windows)## TODO:
- Ubuntu's Unity & OSX window hide implementation
(needed for hiding the window another python interpreter creates)
- grab window focus back - each notification steals focus from the main window
(linux & OSX)
- forbid notification to print Kivy initialisation logs to output
unless asked for it
- positioning and stacking relatively to the taskbar (linux & OSX)## Example:
```
from kivy.app import App
from functools import partial
from kivy.uix.button import Button
from kivy.resources import resource_find
from kivy.garden.notification import Notificationclass Notifier(Button):
def __init__(self, **kwargs):
super(Notifier, self).__init__(**kwargs)
self.bind(on_release=self.show_notification)def printer(self, *args):
print(args)def show_notification(self, *args):
# open default notification
Notification().open(
title='Kivy Notification',
message='Hello from the other side?',
timeout=5,
icon=resource_find('data/logo/kivy-icon-128.png'),
on_stop=partial(self.printer, 'Notification closed')
)# open notification with layout in kv
Notification().open(
title='Kivy Notification',
message="I'm a Button!",
kv="Button:\n text: app.message"
)class KivyNotification(App):
def build(self):
return Notifier()if __name__ == '__main__':
KivyNotification().run()
```## Taskbar awareness
The widget is aware of the system taskbar's position and size, therefore it
can position itself correctly and stack new notifications in the correct
direction from the taskbar.