solarwind
February 26th, 2008, 03:25 AM
def factory(applet, iid):
image = gtk.Image()
image.set_from_file("/usr/share/icons/gnome/22x22/emblems/emblem-system.png")
ebox = gtk.EventBox()
ebox.connect("button_press_event", showMenu, applet)
applet.add(image)
applet.add(ebox)
applet.show_all()
return True
I'm trying to make a Gnome panel applet that shows an image but acts like a button (just like most panel applets). However, as stated here (http://www.pygtk.org/docs/pygtk/class-gtkimage.html), gtk.Image can not respond to events and must take events from a gtk.EventBox (http://www.pygtk.org/docs/pygtk/class-gtkeventbox.html) but I don't know how to do this. Can someone please help?
image = gtk.Image()
image.set_from_file("/usr/share/icons/gnome/22x22/emblems/emblem-system.png")
ebox = gtk.EventBox()
ebox.connect("button_press_event", showMenu, applet)
applet.add(image)
applet.add(ebox)
applet.show_all()
return True
I'm trying to make a Gnome panel applet that shows an image but acts like a button (just like most panel applets). However, as stated here (http://www.pygtk.org/docs/pygtk/class-gtkimage.html), gtk.Image can not respond to events and must take events from a gtk.EventBox (http://www.pygtk.org/docs/pygtk/class-gtkeventbox.html) but I don't know how to do this. Can someone please help?