home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / python-gnome2-desktop / examples / applet / applet.py next >
Encoding:
Python Source  |  2006-01-20  |  641 b   |  26 lines

  1. #!/usr/bin/env python
  2. import pygtk
  3. pygtk.require('2.0')
  4.  
  5. import gtk
  6. import gnomeapplet
  7. import gobject
  8.  
  9. def background_show(applet):
  10.     print "background: ", applet.get_background()
  11.  
  12. def sample_factory(applet, iid):
  13.     print "Creating new applet instance"
  14.     label = gtk.Label("Success!")
  15.     applet.add(label)
  16.     applet.show_all()
  17.     gobject.timeout_add(1000, background_show, applet)
  18.     return True
  19.  
  20. print "Starting factory"
  21. gnomeapplet.bonobo_factory("OAFIID:GNOME_PythonAppletSample_Factory", 
  22.                            gnomeapplet.Applet.__gtype__, 
  23.                            "hello", "0", sample_factory)
  24. print "Factory ended"
  25.  
  26.