Hey everyone,
When trying to insert an image into a combobox, I couldn't find a good
way online. So, I dug around the docs, and came up with this solution.
self.lst_services = gtk.ListStore(str, gtk.gdk.Pixbuf)
for service in services :
imagefile = '../../data/' + service + '.png'
image = gtk.Image()
image.set_from_file(imagefile)
pixbuf = image.get_pixbuf()
self.lst_services.append((service, pixbuf))
cell = gtk.CellRendererText()
self.cmb_services.pack_start(cell, True)
self.cmb_services.add_attribute(cell, 'text', 0)
imagecell = gtk.CellRendererPixbuf()
self.cmb_services.pack_start(imagecell, False)
self.cmb_services.add_attribute(imagecell, 'pixbuf', 1)
Just though I'd throw that out there. If anyone sees a problem with
this solution, let me know.
Greg
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/