side by side
lines around each change
White space changes
12/23/06 13:33:05 (
The topmost widget ''(a)'' is rendered the full size of the
screen. ''(a)'' then renders ''(b)'', ''(b)'' renders ''(c)''
and so on.
When a widget renders its contained widgets it chooses the size
and position of each contained widget. For example, widget
''(b)'' is responsible for the layout of ''(c)'', ''(d)'' and
== Box, Flow and Fixed Widgets ==
The size of a widget is measured in screen columns and rows.
Widgets that are given an exact number of screen columns and
rows are called box widgets. The topmost widget is always
a box widget.
Much of the information displayed in a console user interface
is text and the best way to display text is to have it flow
from one screen row to the next. Widgets like this that
require a variable number of screen rows are called flow widgets.
Flow widgets are given a number of screen columns and can
calculate how many screen rows they need.
Occasionally it is also useful to have a widget that knows
how many screen columns and rows it requires, regardless of
the space available. This is called a fixed widget.
It is an Urwid convention to
use the variables `maxcol` and `maxrow` to store a widget's
size. Box widgets use the tuple `(maxcol, maxrow)` in
the signature of functions that are passed a size.
Flow widgets use the single-element tuple `(maxcol,)` instead
because they calculate their `maxrow` based on the `maxcol`
value. Fixed widgets expect the value `None` to be passed in
to functions that take a size because they know their `maxcol`
and `maxrow` values.
- Console User Interface Library for Python