2.2.4. Vertical and Horizontal Alignment (layout.managers.directional)

class layout.managers.directional.EqualColumnsLM(margin=0, elements=[])

Bases: layout.managers.root.GroupLayoutManager

Arranges a set of elements into equally sized columns.

get_minimum_size(data)

The minimum width is the number of columns multiplied by the widest element.

render(rect, data)

Draws the columns.

class layout.managers.directional.EqualRowsLM(margin=0, elements=[])

Bases: layout.managers.root.GroupLayoutManager

Arranges a set of elements into equally sized rows.

get_minimum_size(data)

The minimum height is the number of rows multiplied by the tallest row.

render(rect, data)

Asks the element to render itself.

class layout.managers.directional.HorizontalLM(margin=0, vertical_align=3, horizontal_align=14, elements=[])

Bases: layout.managers.root.GroupLayoutManager

Keeps a set of elements alongside one another. We can control how they are distributed horizontally, as well as their vertical alignment.

Arguments:

margin
The amount of space to place between elements.
vertical_align
How elements should be aligned vertically in the layout (default: ALIGN_GROW).
horizontal_align
How elements should be aligned horizontally within the layout, and how extra space should be distributed between them (default: ALIGN_EQUAL_GROWTH).
ALIGN_BOTTOM = 2

Align each element to the bottom of the layout.

ALIGN_CENTER = 11

Align the elements so they are in the center of the available space.

ALIGN_EQUAL_GROWTH = 14

Align the elements horizontally so that each gets the same amount of extra space, if the layout is taller than the elements need it to be.

ALIGN_EQUAL_SPACING = 13

Align the elements horizontally so that any additional space is distributed equally between the elements.

ALIGN_GROW = 3

Align each element so that it stretches vertically to fill the layout.

ALIGN_LEFT = 10

Align the elements so they are bunched at the left of the available space.

ALIGN_MIDDLE = 1

Align each element to the middle of the layout.

ALIGN_RIGHT = 12

Align the elements so they sit at the right of the available space.

ALIGN_TOP = 0

Align each element to the top of the layout.

get_minimum_size(data)

Minimum width is the total width + margins, minimum height is the largest height.

render(rect, data)

Displays the elements according to the align properties.

class layout.managers.directional.VerticalLM(margin=0, horizontal_align=13, vertical_align=4, elements=[])

Bases: layout.managers.root.GroupLayoutManager

Keeps a set of elements above one another. We can control how they are distributed vertically, as well as their horizontal alignment.

Arguments:

margin
The amount of space to place between elements.
horizontal_align
How elements should be aligned horizontally within the stack (default: ALIGN_GROW).
vertical_align
How elements should be aligned vertically in the stack, and how extra space should be distributed between them (default: ALIGN_EQUAL_GROWTH).
ALIGN_BOTTOM = 2

Align the elements so they sit at the bottom of the available space.

ALIGN_CENTER = 11

Align each element to the center of the layout.

ALIGN_EQUAL_GROWTH = 4

Align the elements vertically so that each gets the same amount of extra space, if the layout is taller than the elements need it to be.

ALIGN_EQUAL_SPACING = 3

Align the elements vertcially so that any extra space is distributed equally between the elements.

ALIGN_GROW = 13

Align each element so that it stretches horizontally to fill the layout.

ALIGN_LEFT = 10

Align each element to the left of the layout.

ALIGN_MIDDLE = 1

Align the elements so they are in the middle of the available space.

ALIGN_RIGHT = 12

Align each element to the right of the layout.

ALIGN_TOP = 0

Align the elements so they are bunched at the top of the available space.

get_minimum_size(data)

Minimum height is the total height + margins, minimum width is the largest width.

render(rect, data)

Displays the elements according to the align properties.