[pygtk] treemodel problems
Yann Le Boulanger
asterix at lagaule.org
Sun Mar 25 16:57:14 WST 2007
Christopher Cole wrote:
> hey all, i'm confused as to why the following code doesn't work,
> this seems like the most basic thing you could do for a treeview,
> yet i don't see any text from my model being displayed when it's run:
>
you have to create a renderer per column, and you also have to tell the
column in which column of the treestore it has to take the data. here is
a working code for your example:
cols = [ ' Date ', ' Time ', ' Event Type ', ' Message ']
for i in cols:
renderer = gtk.CellRendererText()
col = gtk.TreeViewColumn(i, renderer)
col.add_attribute(renderer, 'text', cols.index(i))
view.append_column(col)
--
Yann
More information about the pygtk
mailing list