[pygtk] Adding columns to a TreeView/TreeStore?
David M. Cook
dave at davidcook.org
Sun Feb 5 22:28:28 WST 2006
On Wed, Feb 01, 2006 at 03:26:11AM +1100, John Pye wrote:
> The issue appears to be that there is no way of adding columns to a
> *TreeStore* -- so I must copy the data from the existing TreeStore to a
> new one with an extra column, then re-set the model for the TreeView to
> the new TreeStore.
> Is there a better way? I imagine this could be slow in some cases where
> there is a lot of data.
Make your TreeStore have just one column of objects and use a cell data
function for each treeview column. Then you can dynamically add attributes
for the new columns. See
http://pygtk.org/pygtk2tutorial/sec-CellRenderers.html#sec-CellDataFunction
Dave Cook
More information about the pygtk
mailing list