Actually, there sort of is a way. You can get the actual size of the container widget. I forgot the name of the function to get the actual size, I think it's get_allocation, see: http://www.daa.com.au/pipermail/pygtk/2001-March/001022.html.
But I think I found an easier funciton, but I don't have the code on me.
Once you have the size of the container widget (your hbox or your table or what-have-you), you can then figure out 2/3 * width and 1/3 * width.

Then call set_size_request() on the child widths with the calculated widths (2/3 * width, etc)

Then trigger a redraw. I use redraw_children on the container widget, but I think there are various ways to trigger a redraw, and I redraw_children seems kind of slow. You could try just invaldating or queue_redraw on the children widgets your resizing..

If you just want to request 2/3 of the container widgets _requested_ size, you should be able to calculate that fairly trivially at the time you make all your requests.

-Stu

then call parent.
From: Steve McClure <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
CC: [email protected]
Subject: Re: [pygtk] Apportioning space when resizing a box
Date: Thu, 01 Mar 2007 08:09:28 -0500

On Wed, 2007-02-28 at 20:43 -0700, Jeffrey Barish wrote:
> Is there a way to apportion space when resizing a box? For example, suppose
> that you have two widgets in a hbox.  Is there a way to specify that one
> should get 1/3 of the available width and the other 2/3? I'm looking for
> something like that the wxPython proportion parameter.

Not that I know of.

>
> Also, is there a concept of a spacer? You might have two widgets that you
> want spaced uniformly on a line.  Specifying spacer | widget1 | spacer |
> widget2 | spacer and turning fill on for the spacers but not for the
> widgets would get the job done.  Is there another way?

I use blank label widgets for spacers.
--
Steve McClure                                   Racemi
email: [EMAIL PROTECTED] 380 Interstate North Pkwy, SE
voice: 404-892-5850                             Suite 250
fax: 404-892-7215                               Atlanta, GA 30339
                                                http://www.racemi.com

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

_________________________________________________________________
Get a FREE Web site, company branded e-mail and more from Microsoft Office Live! http://clk.atdmt.com/MRT/go/mcrssaub0050001411mrt/direct/01/

_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to