Notify.Notification

g GObject.Object GObject.Object Notify.Notification Notify.Notification GObject.Object->Notify.Notification

Subclasses:None

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
class new (summary, body, icon)
  add_action (action, label, callback, *user_data)
  clear_actions ()
  clear_hints ()
  close ()
  get_closed_reason ()
  set_app_name (app_name)
  set_category (category)
  set_hint (key, value)
  set_hint_byte (key, value)
  set_hint_byte_array (key, value)
  set_hint_double (key, value)
  set_hint_int32 (key, value)
  set_hint_string (key, value)
  set_hint_uint32 (key, value)
  set_icon_from_pixbuf (icon)
  set_image_from_pixbuf (pixbuf)
  set_timeout (timeout)
  set_urgency (urgency)
  show ()
  update (summary, body, icon)

Virtual Methods

Inherited:GObject.Object (7)
  do_closed ()

Properties

Name Type Flags Short Description
app-name str r/w The application name to use for this notification
body str r/w/c The message body text
closed-reason int r The reason code for why the notification was closed
icon-name str r/w/c The icon filename or icon theme-compliant name
id int r/w/c The notification ID
summary str r/w/c The summary text

Signals

Inherited:GObject.Object (1)
Name Short Description
closed Emitted when the notification is closed.

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent_object GObject.Object r  

Class Details

class Notify.Notification(**kwargs)
Bases:GObject.Object
Abstract:No
Structure:Notify.NotificationClass
classmethod new(summary, body, icon)
Parameters:
  • summary (str) – The required summary text.
  • body (str or None) – The optional body text.
  • icon (str or None) – The optional icon theme icon name or filename.
Returns:

The new Notify.Notification.

Return type:

Notify.Notification

Creates a new Notify.Notification. The summary text is required, but all other parameters are optional.

add_action(action, label, callback, *user_data)
Parameters:
  • action (str) – The action ID.
  • label (str) – The human-readable action label.
  • callback (Notify.ActionCallback) – The action’s callback function.
  • user_data (object or None) – Optional custom data to pass to callback.

Adds an action to a notification. When the action is invoked, the specified callback function will be called, along with the value passed to user_data.

clear_actions()

Clears all actions from the notification.

clear_hints()

Clears all hints from the notification.

close()
Raises:GLib.Error
Returns:True on success, or False on error with error filled in
Return type:bool

Synchronously tells the notification server to hide the notification on the screen.

get_closed_reason()
Returns:The closed reason code.
Return type:int

Returns the closed reason code for the notification. This is valid only after the “closed” signal is emitted.

set_app_name(app_name)
Parameters:app_name (str) – the localised application name

Sets the application name for the notification. If this function is not called or if app_name is None, the application name will be set from the value used in Notify.init() or overridden with Notify.set_app_name().

New in version 0.7.3.

set_category(category)
Parameters:category (str) – The category.

Sets the category of this notification. This can be used by the notification server to filter or display the data in a certain way.

set_hint(key, value)
Parameters:

Sets a hint for key with value value. If value is None, a previously set hint for key is unset.

If value is floating, it is consumed.

New in version 0.6.

set_hint_byte(key, value)
Parameters:
  • key (str) – The hint.
  • value (int) – The hint’s value.

Sets a hint with a byte value.

Deprecated since version 0.6.: Use Notify.Notification.set_hint() instead

set_hint_byte_array(key, value)
Parameters:
  • key (str) – The hint.
  • value (bytes) – The hint’s value.

Sets a hint with a byte array value. The length of value must be passed as len.

Deprecated since version 0.6.: Use Notify.Notification.set_hint() instead

set_hint_double(key, value)
Parameters:
  • key (str) – The hint.
  • value (float) – The hint’s value.

Sets a hint with a double value.

Deprecated since version 0.6.: Use Notify.Notification.set_hint() instead

set_hint_int32(key, value)
Parameters:
  • key (str) – The hint.
  • value (int) – The hint’s value.

Sets a hint with a 32-bit integer value.

Deprecated since version 0.6.: Use Notify.Notification.set_hint() instead

set_hint_string(key, value)
Parameters:
  • key (str) – The hint.
  • value (str) – The hint’s value.

Sets a hint with a string value.

Deprecated since version 0.6.: Use Notify.Notification.set_hint() instead

set_hint_uint32(key, value)
Parameters:
  • key (str) – The hint.
  • value (int) – The hint’s value.

Sets a hint with an unsigned 32-bit integer value.

Deprecated since version 0.6.: Use Notify.Notification.set_hint() instead

set_icon_from_pixbuf(icon)
Parameters:icon (GdkPixbuf.Pixbuf) – The icon.

Sets the icon in the notification from a GdkPixbuf.Pixbuf.

Deprecated since version ???: use Notify.Notification.set_image_from_pixbuf() instead.

set_image_from_pixbuf(pixbuf)
Parameters:pixbuf (GdkPixbuf.Pixbuf) – The image.

Sets the image in the notification from a GdkPixbuf.Pixbuf.

set_timeout(timeout)
Parameters:timeout (int) – The timeout in milliseconds.

Sets the timeout of the notification. To set the default time, pass Notify.EXPIRES_DEFAULT as timeout. To set the notification to never expire, pass Notify.EXPIRES_NEVER.

Note that the timeout may be ignored by the server.

set_urgency(urgency)
Parameters:urgency (Notify.Urgency) – The urgency level.

Sets the urgency level of this notification.

See: Notify.Urgency

show()
Raises:GLib.Error
Returns:True if successful. On error, this will return False and set error.
Return type:bool

Tells the notification server to display the notification on the screen.

update(summary, body, icon)
Parameters:
  • summary (str) – The new required summary text.
  • body (str or None) – The optional body text.
  • icon (str or None) – The optional icon theme icon name or filename.
Returns:

True, unless an invalid parameter was passed.

Return type:

bool

Updates the notification text and icon. This won’t send the update out and display it on the screen. For that, you will need to call Notify.Notification.show().

do_closed() virtual

Signal Details

Notify.Notification.signals.closed(notification)
Signal Name:closed
Flags:RUN_FIRST
Parameters:notification (Notify.Notification) – The object which received the signal

Emitted when the notification is closed.

Property Details

Notify.Notification.props.app_name
Name:app-name
Type:str
Default Value:None
Flags:READABLE, WRITABLE

The application name to use for this notification

Notify.Notification.props.body
Name:body
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT

The message body text

Notify.Notification.props.closed_reason
Name:closed-reason
Type:int
Default Value:-1
Flags:READABLE

The reason code for why the notification was closed

Notify.Notification.props.icon_name
Name:icon-name
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT

The icon filename or icon theme-compliant name

Notify.Notification.props.id
Name:id
Type:int
Default Value:0
Flags:READABLE, WRITABLE, CONSTRUCT

The notification ID

Notify.Notification.props.summary
Name:summary
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT

The summary text