[pygtk] set VPaned position on resize

Joel Hedlund yohell at ifm.liu.se
Fri Nov 28 18:12:42 WST 2008


Joel Hedlund wrote:
> I have a Window containing a VPaned, and I want its .position to change 
> on window resize so that the lower pane remains constant in height after 
> the resize. How do I do this? Google does not seem to know.

bah. Serves me right for googling instead of reading the docs. Just set 
the resize parameter to the exact opposites of the defaults for .pack1() 
and .pack2() of the VPaned. It's as simple as this:

p = gtk.VPaned()
p.pack1(gtk.Button('Upper resized'), resize=True)
p.pack2(gtk.Button('Lower constant'), resize=False)
w = gtk.Window()
w.add(p)

Note to self: With pygtk, it's always easy. If you think it's hard, it's 
because you've forgotten to read the manual.

/Joel


More information about the pygtk mailing list