[pygtk] treeView and pixbufs

marana at das.ufsc.br marana at das.ufsc.br
Thu Feb 8 21:53:19 WST 2007


    I have problems settung up a Gtk::TreeView with a column that can
    display a Pixbuf

    The Gtk::TreeView is OK in my application but I miss the pixbufs.

    Here is the class for the Gtk::TreeModelColumns:
    someone knows how to do?

image = gtk.Image()
        image.set_from_file("D:\image3.png")

        image.show()

      self.tree_store = gtk.TreeStore( str, gtk.gdk.Pixbuf , str )
      self.teste = 0
      self.parent = self.tree_store.append( None, ["Regions", image, None])

        # create a CellRenderers to render the data
        self.cellpb = gtk.CellRendererPixbuf()
        self.cell = gtk.CellRendererText()
        self.cell1 = gtk.CellRendererText()

        # add the cells to the columns - 2 in the first

        self.view = self.C_mainTreeView.set_model(self.tree_store)
        self.column0 = gtk.TreeViewColumn("Network")
        self.column0.pack_start(self.cellpb, False)
        self.column0.pack_start(self.cell, True)
        self.column0.set_attributes(self.cellpb, pixbuf = 1)
        self.column0.set_attributes(self.cell, text=0)
        self.C_mainTreeView.append_column( self.column0 )



More information about the pygtk mailing list