On Wed, 14 Mar 2001, George Young wrote:

> [gtk+-1.2.8, pygtk-0.6.6, python 2.1a2, linux]
> I have a bunch of widgets in a vbox inside a scrolledwindow.
> If a user clicks on button that makes it's widget open up much bigger(higher),
> the new content may extend below the bottom of the scrolled window.  
> 
> But the new content is what the user just asked for, so I need to force it 
> to be visible by programatically adjusting the scrollbar.  
> 
> If the widget is bigger than the scrolledwin, then the top of the widget should be
> aligned to the top of the scrolledwin, else the bottom of the widget should be 
> set to the bottom of the scrolledwin.
> 
> I assume I need somehow to find the pixel location, within the parent vbox, 
> of the bottom and top of the target widget and then fiddle the scrolledwin's
> vertical 'adjustment', but I have no idea how to do this...

Call the widget.get_allocation() method on the child.  This will return an
(x, y, width, height) tuple.  You can then use this to set the value of
the scrollbar's GtkAdjustment.

James.


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to