Place icon left of the text in treeview column using Python and GTK3 -
i'm using code add icons treeview column:
def build_tree_view(self): self.explorer_store = gtk.treestore(pixbuf, str, str) icon = gtk.icontheme.get_default().load_icon("folder", 22, 0) connname, conndata in self.config.get('connections', {}).items(): parent = self.explorer_store.append(none, [icon, connname, self.get_dsn(conndata)]) self.tree_view = gtk.treeview(self.explorer_store) renderer_pixbuf = gtk.cellrendererpixbuf() renderer_text = gtk.cellrenderertext() column1 = gtk.treeviewcolumn("column", renderer_text) column1.pack_start(renderer_text, true) column1.pack_start(renderer_pixbuf, false) column1.add_attribute(renderer_pixbuf, "pixbuf", 0) column1.add_attribute(renderer_text, "text", 1) self.tree_view.append_column(column1)
and got result:
how can align icons left of text?
i found solution! when create column not need pass renderer second parameter:
column1 = gtk.treeviewcolumn("column", renderer_text)
the correct code is:
column1 = gtk.treeviewcolumn("column")
Comments
Post a Comment