Rebecca Breu wrote:
Hi!

What do I have to do to make a Pile which contains box and flow widgets
behave as a box widget?

I have something like:

    flow1 = urwid.Text("asdf");
    flow2 = urwid.Text(";lkj");
    box1 = urwid.Filler(urwid.Text("laskdfj"));

    widget = urwid.Pile([flow1, flow2, ("fixed", 3, box1)]);
This widget will only work as a flow widget. You have given box1 a fixed height so it will be treated as a box widget either way, but if you use this widget as a box widget the Pile will try to share the remaining rows between flow1 and flow2, treating them as box widgets.

    widget = urwid.Pile([flow1, flow2, box1]);
Similarly, if you treat this widget as a box widget the pile will try to share the rows available to it between flow1, flow2 and box1, treating them all as box widgets.

What you want is:

widget = urwid.Pile([('flow',flow1), ('flow',flow2), box1])

This widget will work as a box widget. The 'flow' tells the Pile that flow1 and flow2 are flow widgets and should calculate their own heights before trying to allocate the remaining rows between the other widgets (box1 in this case).

Maybe I should add some examples to the documentation of Pile.__init__()
http://excess.org/urwid/reference.html#Pile

HTH,
Ian


_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid

Reply via email to