[pygtk] treemodel problems

Christopher Cole ccole2 at mix.wvu.edu
Sun Mar 25 17:26:37 WST 2007


Yann Le Boulanger wrote:
> 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)
>
>   
gosh i spent so much time on that...thank you very much!

--Chris


More information about the pygtk mailing list