[pygtk] A question about TreeViews

remi.sassolas at gmail.com remi.sassolas at gmail.com
Tue Jun 27 21:24:35 WST 2006


Hi,
I would like to use a TreeView to display arrays of values (several columns
of values).
I haven't looked for it very carefully but I haven't found a way to add
borders to the cells.
Does anyone know how to proceed ?

Here is a short example of the kind of array I would like to display :

# File treeview_example.py
import gtk

win =3D gtk.Window()
win.connect("destroy", gtk.main_quit)

treeview =3D gtk.TreeView()
win.add(treeview)

renderer =3D gtk.CellRendererText()
column =3D gtk.TreeViewColumn("column1", renderer, text=3D0)
treeview.append_column(column)

renderer2 =3D gtk.CellRendererText()
column2 =3D gtk.TreeViewColumn("column2", renderer2, text=3D1)
treeview.append_column(column2)

treestore =3D gtk.TreeStore(*[str, str])
treestore.append(None, ["value1", "value4"])
treestore.append(None, ["value2", "value5"])
treestore.append(None, ["value3", "value6"])

treeview.set_model(treestore)

win.show_all()
gtk.main()

# End of file

Thanks in advance for any help provided !
-- =

Remi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20060627/4c27a4bf/at=
tachment.htm


More information about the pygtk mailing list