On 2010-08-23 8:09, Greg Bair wrote:
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()

The better way to load a pixbuf from a file is:

    pixbuf = gtk.gdk.pixbuf_new_from_file(imagefile)

--
Tim Evans
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to