[pygtk] Scrolling to the previous position in a TreeView

Walter Leibbrandt walter at translate.org.za
Fri Jan 30 19:06:17 WST 2009


Hi,

Lionel Dricot wrote:
> So it works with :
>
> gobject.timeout_add(100, 
> self.task_tview.get_vadjustment().set_value,vscroll_value)
>
> The problem is that the delay is very noticable ! You see the content 
> jumping up and down and it's really ugly. A smaller delay (10) doesn't 
> work at all. 50 works but I believe that it might not work everywhere.
When I need to do a "do-this-a-bit-later" kind of call, I always try 
gobject.idle_add(func) first. With idle_add() the delay is only as long 
as it takes for the requests in the event queue to be processed 
(depending on a few things). No more and no less. It's usually less than 
any custom time-out value and not specific to the development machine.

IMHO using idle_add() is already an ugly hack. Using timeout_add() (for 
things where specific time measurement is not involved) is even uglier 
and should be used with caution.

HTH

Walter

-- 
Walter Leibbrandt                  http://translate.org.za/blogs/walter
Software Developer                                  +27 12 460 1095 (w)
Translate.org.za

Recent blogs:
* Virtaal's MVCisation
http://www.translate.org.za/blogs/walter/en/content/virtaals-mvcisation
* Things that changed the way I code
* Switching from Subversion to git




More information about the pygtk mailing list