Created
December 31, 2010 01:50
-
-
Save blaze33/760615 to your computer and use it in GitHub Desktop.
Clock screenlet protoype using the NotifyOSD graphic interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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