[pygtk] liststore (ComboBoxEntry) alignment (justify)

Andrea Caminiti a.caminiti at yahoo.com
Wed Apr 23 00:02:48 WST 2008


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)

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

nrayever



      ____________________________________________________________________________________
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