Skip to content

Instantly share code, notes, and snippets.

@blaze33
Created December 31, 2010 01:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blaze33/760615 to your computer and use it in GitHub Desktop.
Save blaze33/760615 to your computer and use it in GitHub Desktop.
Clock screenlet protoype using the NotifyOSD graphic interface
#!/usr/bin/env python
try:
import gtk, gobject, pygtk, os, os.path, pynotify, time
pygtk.require('2.0')
except:
print "Error: need python-notify, python-gtk2, python-gobject and gtk"
def my_timer(n):
n.update("NotifyOSD Clock", time.asctime())
n.show()
return True
if __name__ == '__main__':
if not pynotify.init("NotifyOSD Clock"):
sys.exit(1)
n = pynotify.Notification("NotifyOSD Clock", time.asctime())
#n = pynotify.Notification("Moo title", "test", "file:///path/to/icon.png")
n.set_urgency(pynotify.URGENCY_LOW)
n.set_timeout(1000)
#Call an icon
helper = gtk.Button()
#print gtk.stock_list_ids()
icon = helper.render_icon(gtk.STOCK_INFO, gtk.ICON_SIZE_DIALOG)
n.set_icon_from_pixbuf(icon)
gobject.timeout_add(1000, my_timer, n) #update each second
loop = gobject.MainLoop()
loop.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment