PDA

View Full Version : pynotify question



NikitaUtiu
July 10th, 2010, 08:34 PM
I have been recently working on a project using pynotify. I want to know if there is any way to set the time the notification is visible ?

n = pynotify.Notification ("blah blah", "blah blah")
# for example

And any member function or something to set the amount of time the notification on befor it closes?
P.S. Using Ubuntu (GNOME)

detrate
July 11th, 2010, 03:18 PM
After initializing your notification object (like you did), use:


n.set_timeout(10000)

time is in milliseconds.

You may also be interested in experimenting with the following:

Set urgency:

n.set_urgency(pynotify.URGENCY_LOW)
n.set_urgency(pynotify.URGENCY_NORMAL)
n.set_urgency(pynotify.URGENCY_CRITICAL)


Set icon:

icon = helper.render_icon(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG)
n.set_icon_from_pixbuf(icon)


The pynotify api documentation is close to non-existent. I ran through similar problems a few weeks ago. Good Luck :)