El 2013-08-04 20:50, Ian Ward escribió:
> I would use a ListBox or Pile of Columns widgets with equal given
> widths or weights for each column to make a table.
>
> Ian
>
Thanks Ian. The following piece of code based on your suggestion does
what I want. However, I'm not sure if the way of getting the width of
the fixed columns, using the pack() method of the Text widget in each
column, is the correct way of doing it (IMHO, looks quite ugly!). Am I
getting it right?
________________________
import urwid as u
htxt1 = u.Text("Header1", "center")
htxt2 = u.Text("Header2", "center")
htxt3 = u.Text("Header3", "center")
htxt4 = u.Text("Header4", "center")
htxt5 = u.Text("Header5", "center")
header1 = u.Pile((htxt1, u.Divider("=")))
header2 = u.Pile((htxt2, u.Divider("=")))
header3 = u.Pile((htxt3, u.Divider("=")))
header4 = u.Pile((htxt4, u.Divider("=")))
header5 = u.Pile((htxt5, u.Divider("=")))
txt11 = txt21 = u.Text("X")
txt12 = txt23 = u.Text("FoBar")
txt13 = txt24 = u.Text("Foooo Bar")
txt14 = txt25 = u.Text("Foooooo Baaar")
txt15 = txt22 = u.Text("Fooo Bar")
row1 = u.Columns(((htxt1.pack()[0], header1), header2, header3,
(txt14.pack()[0], header4), header5), 1)
row2 = u.Columns(((htxt1.pack()[0], txt11), txt12, txt13,
(txt14.pack()[0], txt14), txt15), 1)
row3 = u.Columns(((htxt1.pack()[0], txt21), txt22, txt23,
(txt14.pack()[0], txt24), txt25), 1)
table = u.Pile((row1, row2, row3))
Cheers,
Oscar
_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid