Skip to main content

Python interface to DBus notifications

Project description

This is a pure-python replacement for notify-python, using python-dbus to communicate with the notifications server directly. It’s compatible with Python 2 and 3, and its callbacks can work with Gtk 3 or Qt 4 applications.

To use it, first call notify2.init('app name'), then create and show notifications:

n = notify2.Notification("Summary",
                         "Some body text",
                         "notification-message-im"   # Icon name
                        )
n.show()

To see more of what’s possible, refer to docstrings of methods and objects.

Based on the notifications spec at: http://developer.gnome.org/notification-spec/

Porting applications from pynotify

There are a few differences from pynotify you should be aware of:

  • If you need callbacks from notifications, notify2 must know about your event loop. The simplest way is to pass ‘glib’ or ‘qt’ as the mainloop parameter to init.

  • The methods attach_to_widget and attach_to_status_icon are not implemented. You can calculate the location you want the notification to appear and call Notification.

  • set_property and get_property are not implemented. The summary, body and icon are accessible as attributes of a Notification instance.

  • Various methods that pynotify Notification instances got from gobject do not exist, or only implement part of the functionality.

Several pynotify functions, especially getters and setters, are only supported for compatibility. You are encouraged to use more direct, Pythonic alternatives.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

notify2-0.3.tar.gz (8.8 kB view details)

Uploaded Source

File details

Details for the file notify2-0.3.tar.gz.

File metadata

  • Download URL: notify2-0.3.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for notify2-0.3.tar.gz
Algorithm Hash digest
SHA256 684281f91c51fc60bc7909a35bd21d043a2a421f4e269de1ed1f13845d1d6321
MD5 6b2f6400999956652e4c9bc83d87607b
BLAKE2b-256 7fbef749b44ac10ca9e4b9e54a9549e37233b30451bd1c12ece640bec730c0e5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page