[pygtk] comboboxes and images
Greg Bair
gregbair at gmail.com
Mon Aug 23 10:39:35 WST 2010
On 08/22/2010 07:00 PM, Tim Evans wrote:
> 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)
>
Thanks!
More information about the pygtk
mailing list