Programster's Blog

Tutorials focusing on Linux, programming, and open source

Python Notifier

You've probably noticed pop-up dialogues appearing when you have new mail in Thunderbird, or Dropbox has been updated etc. Every modern Linux desktop distribution appears to have these.

It's really easy to create these notifications in Python. You can even add icons to them, although this is rarely used.

The example below creates a class that can be used to create new notifications in the "GTK3 based programming style".

from gi.repository import GObject
from gi.repository import Notify

class SimpleNotifier(GObject.Object):

    def __init__(self):
        super(SimpleNotifier, self).__init__()
        # lets initialise with the application name

    def sendNotification(self, title, text, file_path_to_icon=""):
        n =, text, file_path_to_icon)

my = SimpleNotifier()
my.sendNotification("this is a title", "this is some text")

Below is more procedural example.

from gi.repository import Notify


title = "Title goes here"
text = "Body goes here"
icon_path = ""

notification =, text, icon_path)