[pygtk] How do I force resize of a top-level window?

Eric Raymond esr at thyrsus.com
Fri Dec 18 07:01:12 WST 2009


Pietro Battiston <toobaz at email.it>:
> Il giorno gio, 17/12/2009 alle 21.25 +0330, Saeed Rasooli ha scritto:
> > I think this is what you need: if the three zones are placed
> > vertically(one below other), then set a "height-request" to every
> > zone(the fixed height that it need). and pack every zone with
> > expand=False and fill=False. for exmaple:
> > _______________________________________
> > 
> > ## first Create three widgets zone1, zone2, zone3, and then...
> > 
> > zone1.set_property('height-request', 200)
> > zone2.set_property('height-request', 200)
> > zone3.set_property('height-request', 200)
> > 
> > vbox = gtk.VBox()
> > win = gtk.Window()
> > 
> > ## Now pack them will NO EXPAND and NO FILL options
> 
> I'm afraid it's not enough. The window will leave some empty space, it
> won't shrink.
> 
> But indeed, at this point you can call resize(1,1)

Yesterday I found a way to do almost what I want.  After each hide or show 
operation, calling the reshow_with_initial_size() method on the top-level
window resizes it properly.  Unfortunately, it also had a tendency to
move the window around, 

resize(1, 1) on the top-level window is better and seems to work even
without declaring any fixed sizes for the child widgets.  That was the
magic I needed.

The reason I'm doing this, byy the way, is that I want the test client to be
usable on displays of limited size.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>


More information about the pygtk mailing list