[pygtk] liststore (ComboBoxEntry) alignment (justify)

John Finlay finlay at moeraki.com
Wed Apr 23 07:26:38 WST 2008


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.
>         #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?

John


More information about the pygtk mailing list