[pygtk] Restore a scrolling position
walter at translate.org.za
Thu Feb 19 21:23:15 WST 2009
If you are changing the store, I would suggest a different approach:
This would require you to have some way to identify any given row
uniquely (unless the first "matching" row is acceptable) and also to
"remember" the selected row before performing your update. Then you can
use gtk.TreeView.scroll_to_cell() to scroll back to the remembered row.
Using scroll_to_cell(path, column, True, 0.5, 0.5) you can get the
remembered row nice and centered (if possible). See the docs () for more
details on the parameters:
Lionel Dricot wrote:
> In a previous mail, I asked about restoring the scrolling position in
> a treeview :
> This was solved thanks to Neil and Walter with the following line of
> codes at the end of my refresh function :
> (with values being read at the start of the refresh function, of course)
> But I discovered a problem : if elements have been removed from the
> treeview, the scroll will go to an empty position.
> In some case, it means that you will see only a blank treeview because
> remaining elements are hidden on top (but no scrollbar are displayed).
> So how can check before inserting the scroll_value that I didn't pass
> the upper bound of the possible scroll ?
Walter Leibbrandt http://translate.org.za/blogs/walter
Software Developer +27 12 460 1095 (w)
* Virtaal's MVCisation
* Things that changed the way I code
* Switching from Subversion to git
More information about the pygtk