[pygtk] Scrolling with not scrollbars

Thorsten Wilms t_w_ at freenet.de
Tue Apr 22 03:51:37 WST 2008


On Sun, 2008-04-20 at 14:10 -0700, John Finlay wrote:

> A textview has adjustments built-in so it doesn't need to be put inside 
> a viewport. Use the set_scroll_adjustments() method to set the 
> adjustments for the textview.

Thanks, but I have no luck with this (and no good concept, obviously).

First it confuses me that you can't get an adjustment from the textview,
you can only set it, which looks to me like guesswork for reasonable
values.

Then
   adj = gtk.Adjustment(0.8, 0.0, 1.0, 0.1, 0.1, 0.1)
   textview.set_scroll_adjustments(None, adj)

doesn't result in a scrolled textview

   adj.set_value(0.2)
does nothing, too

Using a viewport and getting the adjustment from it to then change value
also doesn't work.


After reading some more, it looks to me like you have to use iters to
scroll a textview? So scrolling would be line-based. Within a viewport
it would be pixel-based, then?

At least I found out hat using a scrolledwindow has an advantage:
Scrolling to follow the cursor happens automatically.


-- 
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/



More information about the pygtk mailing list