Saturday, 4 July 2009
cross platform popup notifications in gtk
Recently I've been building a cross platform microblogging system in python with gtk. I was used to using py-notify on the linux platform to give the user popup notifications, however this would obviously not work on windows. I experiemented with the balloon notifications that windows has, but felt they were a bit limiting (no way to add images easily, and to be frank, interacting with the win32api was giving me suicidal tendencies.
I've created a simple class, gtkPopupNotify to deal with these things and it's available at github. Using it is simple:
import gtkPopupNotify
notifier = gtk.PopupNotify.NotificationStack(timeout=6) notifier.new_popup(title="Sample popup", message="This is a popup", image="exclamation.png")
Colours, positioning etc. can all be set via the object properties and will affect all popups created afterwards, eg.
notifier.bg_color = gtk.gdk.Color("green")
Current problems: Not sure how to check for panel placement so the popup doesn't cover a users panel. On many systems I could use:
notifier.edge_offset_y = 30
but obviously this isn't very portable. Suggestions welcome!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment