2.2.1. Aligning Elements in Larger Spaces (layout.managers.align
)¶
-
class
layout.managers.align.
AlignLM
(min_width=0, min_height=0, horizontal_align=10, vertical_align=0, element=None)¶ Bases:
layout.managers.root.LayoutManager
A layout manager that takes one element and aligns it according to the given parameters, optionally within a box of at least a given size. Several of the other layout managers do some alignment as part of their normal behavior.
Arguments:
min_width
- The minimum width to reserve, even if the managed element is smaller.
min_height
- The minimum height to reserve, even if the managed element is smaller.
horizontal_align
- One of the constants defined in this class for how the
element should be aligned horizontally within its space
(default:
ALIGN_LEFT
) vertcal_align
- One of the constants defined in this class for how the
element should be aligned vertically within its space
(default:
ALIGN_TOP
)
-
ALIGN_BOTTOM
= 2¶ Align the element to the bottom of the space.
-
ALIGN_CENTER
= 11¶ Align the element to the horizontal center of the space.
-
ALIGN_LEFT
= 10¶ Align the element to the left of the space.
-
ALIGN_MIDDLE
= 1¶ Align the element to the vertical middle of the space.
-
ALIGN_RIGHT
= 12¶ Align the element to the right of the space.
-
ALIGN_TOP
= 0¶ Align the element to the top of the space.
-
GROW_X
= 13¶ Align the element to left and right, making it grow horizontally.
-
GROW_Y
= 3¶ Align the element to top and bottom, making it grow vertically.
-
get_minimum_size
(data)¶ Returns the minimum size of the managed element, as long as it is larger than any manually set minima.
-
render
(rect, data)¶ Draws the managed element in the correct alignment.