On Thu, Oct 8, 2009 at 1:38 PM, Bertrand Son Kintanar
<[email protected]> wrote:
> On Thu, Oct 8, 2009 at 8:43 PM, samwyse <[email protected]> wrote:
>>
>> First off, yes this request can be approximated via a Table; that just
>> seems like overkill, however.
>
> I dont think this is duable in HBox. Care to enlighten us why you wouldn't
> use Tables for this instead and why you claimed that using Tables in this
> scenario is overkill?

I'd think that comparing gtk.Box.pack_{start,end}(child, expand=True,
fill=True, padding=0) to gtk.Table.attach(child, left_attach,
right_attach, top_attach, bottom_attach, xoptions=gtk.EXPAND|gtk.FILL,
yoptions=gtk.EXPAND|gtk.FILL, xpadding=0, ypadding=0) would be
explanation enough.  If not, consider that you can't use a simple
wrapper to turn calls to pack_start into calls to attach; to support
both pack_start and pack_end you need a bit of private data to figure
out the attachment points for each new child.  You also need to resize
the table as each child is added.  Fortunately, I don't anticipate a
need to reorder the children; that would open a whole 'nother can of
worms.

>> I need a Weighted Hbox.  By that, I mean that the pack_start and
>> pack_end methods would have a weight parameter, defaulting to 1 and
>> ignored unless expand is True.  Any child with a weight of 2 would
>> occupy twice the space of one with a width of 1.
>>
>> Has anyone seen such a thing before?  If not, can anyone estimate how
>> difficult sub-classing Box or HBox would be (since I need to
>> manipulate the widths of the children), or should I just start at
>> Container and re-implement all of the Box functionality?

Boxes don't seem to allow over-riding of how they arrange their
children, so I wasn't really expecting that idea to work.  Wrapping
Table, as indicated above, will take a fair amount of code.
Subclassing a Container seems like it would take a similar amount of
code, but I'd mostly just be duplicating Box's code instead of
fighting with Table's internal representation.  But I've never heard
of anyone subclassing a Container, so I can't be sure.  I guess I'll
spend a few hours and see how far I can get.
_______________________________________________
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