Python system tray notifications in Linux

As a follow up to my previous post, here’s how to accomplish system tray notifications in ubuntu linux and family. I must say, compared to windows, this is child’s play… under ten lines of code!

#!/usr/bin/python
import sys
import pynotify

if __name__ == ‘__main__’:
if not pynotify.init (“summary-body”):
sys.exit (1)

# try the summary-body case
n = pynotify.Notification (“Cloudlink”,
“Hello Brian 🙂 “)
n.show ()

 

This results in something like this (under linux mint – top right corner):

Screenshot from 2013-10-19 12:49:46

A full, more involved example can be found here

Advertisement

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.