[pygtk] Row number column
Osmo Salomaa
otsaloma at cc.hut.fi
Wed May 9 18:28:47 WST 2007
ti, 2007-05-08 kello 10:59 +0200, Fredrik Corneliusson kirjoitti:
> I wonder about the best way to add row numbers to a gtk.TreeView with
> a gtk.ListStore model.
I believe the best way is to add an integer column to the list store and
use 'set_cell_data_func' as follows to set the row number to update
automatically after whatever changes in the list store.
def set_row_number(column, renderer, store, itr):
renderer.props.text = store.get_path(itr)[0] + 1
column.set_cell_data_func(renderer, set_row_number)
--
Osmo Salomaa
More information about the pygtk
mailing list