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
vbox.pack_start(zone1, False, False)
vbox.pack_start(zone2, False, False)
vbox.pack_start(zone3, False, False)

win.add(vbox)
vbox.show_all()
win.present()
_________________________________
Now all of zones will be shown, and you can hide (and re-show again)
every zone during the program, then other zones will not expand (and
increase it's size), but the window will be resize and decrease it's
height to the minimum needing height.

maybe were useful Mr. Raymond. :)

On 12/16/09, Pietro Battiston <[email protected]> wrote:
> Il giorno mer, 16/12/2009 alle 08.30 -0500, Eric Raymond ha scritto:
>> For the GPSD project <http://gpsd.berlios.de/>, I have just rewritten
>> our crufty old Motif-based test client, xgps, in pygtk.  It was a
>> pleasant experience. There is one feature I want that I can't seem to
>> get working right, however.
>>
>> The client display consists of three horizontal zones: a sky
>> view, a raw-data display, and a GPS report display. I have written a
>> "View" menu with three toggle-button entries to toggle showing or
>> hiding each of these zones.  All are initially shown. Toggling hides
>> and re-shows them; so far, so good.
>>
>> But...the *intended* behavior (which I used to exploit under TkInter)
>> is that when I hide a zone, the top-level window shrinks vertically
>> to fit the remaining zones, which are still packed as before. Conversely,
>> when I re-show a zone, the window should re-size to the minimum needed
>> to hold it and its siblings.
>>
>> Calling queue_resize() on the top-level window doesn't do this. Is there
>> some magic I need to mutter at the window manager?
>
> If I recall correctly:
> 1) what you're trying to do is not contemplated in (py)gtk for the
> reason that a user should presumably hate to see the window size
> changing in front of his eyes when it's not strictly necessary
> 2) the best approach to force that behaviour is to explicitely call
> gtk.Window.resize(). There are two cases
>  1: your widgets (those still showing up) currently all occupy exactly
> their size request: then just the_window.resize(1,1) is fine - it
> resizes to the smallest possible size
>  2: some widget is currently bigger than its current size request (and
> you don't want to shrink it): if you _know_ their size, there's no
> problem; if you don't, you should be able to get it from the
> size_request() (NOT get_size_request()!) of the biggest child (an HBox,
> I presume).
> 3) the "gtkish" way to do something similar to what you're trying to
> should be to not make the zone disappear, but for instance just set it
> as insensitive.
>
> Pietro
>
> P.S: you'll probably not need it, but just in case:
> http://www.pietrobattiston.it/wiki/doku.php?id=pygtk:resizing
>
> _______________________________________________
> pygtk mailing list   [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to