[pygtk] TreeView (liststore) sorting.

middleofdreams at gmail.com middleofdreams at gmail.com
Thu Feb 4 14:59:07 WST 2010


I have now something like that:
 view['listmodel'].set_sort_column_id(5,gtk.SORT_DESCENDING)
    view['listmodel'].set_sort_func(5,compare_data, 5)
    view['listmodel'].set_sort_func(0,compare_data, 0)

...

def compare_data(model, iter1, iter2, column):
           data1 = model.get_value(iter1,column)
           data2 = model.get_value(iter2,column)
           print data1, data2, cmp(data1, data2)
           return cmp(data1, data2)


but it sorts only by column 5. tried also
  view['listmodel'].set_sort_func(5,compare_data, 0)
but it doesn't work...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20100204/c9c2ee04/attachment.htm 


More information about the pygtk mailing list