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/

Reply via email to