On Mon, 2008-04-21 at 14:16 -0700, John Finlay wrote:
>   
> Try some larger values for the upper and step, etc. These aren't limited 
> to 0-1.0. I suspect that the range values is lines and characters.

I thought it wouldn't matter if I define the range ...
But indeed, with larger values, adj.set_value() does have an effect.

In the version where placed the textview in a scrolledwindow, adj.upper
returns 204.0. But any value I set below to including 204.0 only scrolls
the view a few line, it doesn't even come close to the end.
What I also don't get at all: adj.page_size gives me 0.0.

I'm trying to do this in main, to get the basic concept of scrolling a
textview, before seeing how I can connect my special scrollbar:

def main():
        window = gtk.Window()
        hbox = gtk.HBox(homogeneous=False, spacing=0)
        
        textview = gtk.TextView()
        textview.set_editable(False)
        textfile = open("demo_popup_scrollbar_20.py", "r")
        buffer = textview.get_buffer()
        buffer.set_text(textfile.read())
        
        view = gtk.ScrolledWindow(None, None)
        view.set_policy(gtk.POLICY_NEVER, gtk.POLICY_NEVER)
        view.set_shadow_type(gtk.SHADOW_NONE)
        view.add(textview)
        
        scroller = PopupScroller()

        # Layout
        window.add(hbox)
        hbox.pack_start(view, True, True)
        hbox.pack_start(scroller, False, False)
        scroller.set_size_request(16, 200)
        view.set_size_request(400, 200)
        #window.resize(200, 300)

        adj = view.get_vadjustment()
        # value, lower, upper, step_incr, page_incr, page_size
        print adj.value
        print adj.lower
        print adj.upper
        print adj.step_increment
        print adj.page_increment
        print adj.page_size
        view.set_vadjustment(adj)
        adj.set_value(180.0)
        print adj.value

        
        # Connect       
        window.connect("destroy", gtk.main_quit)
        
        window.realize()
        window.show_all()
        
        gtk.main()

Thanks!

-- 
Thorsten Wilms

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

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to