[pygtk] liststore (ComboBoxEntry) alignment (justify)
Andrea Caminiti
a.caminiti at yahoo.com
Wed Apr 23 23:17:06 WST 2008
----- Original Message ----
From: Andrea Caminiti <a.caminiti at yahoo.com>
To: John Finlay <finlay at moeraki.com>
Sent: Wednesday, April 23, 2008 9:16:24 AM
Subject: Re: [pygtk] liststore (ComboBoxEntry) alignment (justify)
>Andrea Caminiti wrote:
>> hi john:
>>
>> i was trying to use the code you just posted to to have a combobox with images and it's labels (text), only, no text entry needed. but i got some warnings.
>>
>> the code i used:
>>
>> def combo(self):
>> #lists = self.list
>> combobox = gtk.ComboBox()
>> list = gtk.ListStore(gtk.gdk.Pixbuf, str)
>> px = gtk.CellRendererPixbuf()
>> text = gtk.CellRendererText()
>> combobox.pack_start(px, True)
>> combobox.pack_start(text, True)
>> combobox.add_attribute(px, "pixbuf", 0)
>> combobox.add_attribute(text, "text", 1)
>> combobox.pack_end(text, True)
>>
>you seem to be adding this twice. I think that's what the error message
is about.
ok, but what am i adding twice? because i need to append 8 elements (image with a label/tag/text) at the combobox. and yes, right now i'm doing that task 8 times. look:
pics = gtk.gdk.pixbuf_new_from_file('c:\\images\\bumps\\NE_to_SW_LowerTrace.jpg')#dicts.images['b1'])
list.append((pics, 'fking shit'))#dicts.names['b1'])
pics = gtk.gdk.pixbuf_new_from_file('c:\\images\\bumps\\NE_to_SW_UpperTrace.jpg')#dicts.images['b1'])
list.append((pics, 'fking shit'))#dicts.names['b1'])
pics = gtk.gdk.pixbuf_new_from_file('c:\\images\\bumps\\NW_to_SE_LowerTrace.jpg')#dicts.images['b1'])
list.append((pics, 'fking shit'))#dicts.names['b1'])
pics = gtk.gdk.pixbuf_new_from_file('c:\\images\\bumps\\NW_to_SE_UpperTrace.jpg')#dicts.images['b1'])
list.append((pics, 'fking shit'))#dicts.names['b1'])
pics = gtk.gdk.pixbuf_new_from_file('c:\\images\\bumps\\SE_to_NW_LowerTrace.jpg')#dicts.images['b1'])
list.append((pics, 'fking shit'))#dicts.names['b1'])
pics = gtk.gdk.pixbuf_new_from_file('c:\\images\\bumps\\SE_to_NW_UpperTrace.jpg')#dicts.images['b1'])
list.append((pics, 'fking shit'))#dicts.names['b1'])
pics = gtk.gdk.pixbuf_new_from_file('c:\\images\\bumps\\SW_to_NE_LowerTrace.jpg')#dicts.images['b1'])
list.append((pics, 'fking shit'))#dicts.names['b1'])
pics = gtk.gdk.pixbuf_new_from_file('c:\\images\\bumps\\SW_to_NE_UpperTrace.jpg')#dicts.images['b1'])
list.append((pics, 'fking shit'))#dicts.names['b1'])
#combobox.set_use_arrows_always(True)
#list
combobox.set_model(list)
#combobox.connect('changed', self.changed_cb)
combobox.set_active(0)
return combobox
Sorry for the bad language. i was tired off trying to make it work my way and not the right way.
>> #for n in range (8):
>> # numb =+ 1
>> pics = gtk.gdk.pixbuf_new_from_file('c:\\images\\bumps\\NE_to_SW_LowerTrace.jpg')#dicts.images['b1'])
>> list.append((pics, 'fucking shit'))#dicts.names['b1'])
>>
>> python warnings:
>>
>> dgc-gui.py:71: GtkWarning: gtk_cell_view_cell_layout_pack_end: assertion `!gtk_c
>> ell_view_get_cell_info (cellview, renderer)' failed
>> combobox.pack_end(text, True)
>> dgc-gui.py:71: GtkWarning: gtk_tree_view_column_cell_layout_pack_end: assertion
>> `! gtk_tree_view_column_get_cell_info (column, cell)' failed
>> combobox.pack_end(text, True)
>> dgc-gui.py:94: GtkWarning: gtk_cell_view_cell_layout_pack_end: assertion `!gtk_c
>> ell_view_get_cell_info (cellview, renderer)' failed
>> combobox.set_model(list)
>> dgc-gui.py:278: GtkWarning: gtk_tree_view_column_cell_layout_pack_end: assertion
>> `! gtk_tree_view_column_get_cell_info (column, cell)' failed
>> window.show()
>>
>> and on the other hand. as you can see, i was trying to use a dictionary in a class to get the name and path for the images. but seem that doesn't work. is there any way to do it?? or i need to write down each path and label for each image...
>>
>What was the error message when you tried this, if any?
yes that are the messages i got when tried it.
nrayever
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
More information about the pygtk
mailing list