Cross-platform desktop notifier in Python

Sridhar Ratnakumar picture Sridhar Ratnakumar · Feb 10, 2010 · Viewed 22.4k times · Source

I am looking for Growl-like, Windows balloon-tip-like notifications library in Python. Imagine writing code like:

>>> import desktopnotifier as dn
>>> dn.notify('Title', 'Long description goes here')

.. and that would notify with corresponding tooltips on Mac, Windows and Linux. Does such a library exist? If not, how would I go about writing one myself?

  • Does Mac come with a default notifier? Is Growl something that I should install separately?
  • On Windows, I assume this may require pywin32?
  • On Linux, assuming GNOME, is there a GNOME API (using gnome-python) that does this?
  • Can I make notifications 'sticky' (i.e., don't fade out ever) on all platforms?

Update: My preference is to not depend on gigantic GUI frameworks like PyQT4 and wxPython for a simple task such as this.

Answer

Stephen McDonald picture Stephen McDonald · Feb 11, 2010

Here's a desktop notifier I wrote a few years ago using wxPython - it behaves identically across Windows and Linux and should also run on OSX. It contains a threaded event loop that can be used to animate a notification window containing an icon and message that can be clicked on. It probably needs a couple of tweaks to customize it for your own purpose but the ground work is done.