Skip to content

Using libnotify and Python

August 14, 2010

Ubuntu 9.04+ has a pretty nice looking notification system. Unfortunately I couldn’t find much online on how to use this, but after some digging on my own system, I found some examples and documentation. The package’s name is libnotify1, and there is a python wrapper library for it called python-notify.

To install it python-notify you can simply run

shreyas@box:~$ sudo apt-get install python-notify

Of course, I will show you some code on how to use it, although you can always look at the examples located in /usr/share/doc/python-notify/examples .


import pygtk
import pynotify
import sys

if __name__ == '__main__':
    if not pynotify.init("Basics"):

    n = pynotify.Notification("Summary", "This is some sample content")

    if not
        print "Failed to send notification"

This is straight from an example I found in /usr/share/doc/python-notify/examples.


From → Linux Tutorials

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: