.. default-domain:: lua .. highlight:: lua .. currentmodule:: UI Layout ====== .. class:: Layout Arranges the elements of a panel automatically, so that they do not have to be positioned one by one. See :meth:`UI.Panel.add_horizontal_layout`, :meth:`UI.Panel.add_vertical_layout` and :meth:`UI.Panel.add_grid_layout`. .. attribute:: spacing: number The gap left between the elements, in pixels. A grid layout uses it in both directions. :Attribute: Can be read or written :rtype: number .. attribute:: padding: UI.Padding The gap left inside the edges of the panel. :Attribute: Can be read or written :rtype: :class:`UI.Padding` .. attribute:: child_alignment: UI.TextAnchor Where the elements are placed within the space the layout has to fill. :Attribute: Can be read or written :rtype: :class:`UI.TextAnchor` .. attribute:: cell_size: Tuple The size of each cell of a grid layout, in pixels. :Attribute: Can be read or written :rtype: Tuple .. note:: Only applies to a grid layout. Throws an exception for the other layouts, whose elements are sized individually using their layout elements. .. attribute:: constraint: UI.GridConstraint What fixes the shape of a grid layout. :Attribute: Can be read or written :rtype: :class:`UI.GridConstraint` .. note:: Only applies to a grid layout. Throws an exception for the other layouts. .. attribute:: constraint_count: number The number of columns or rows that :attr:`UI.Layout.constraint` fixes, ignored when the constraint is :attr:`UI.GridConstraint.flexible`. :Attribute: Can be read or written :rtype: number .. note:: Only applies to a grid layout. Throws an exception for the other layouts. .. class:: Padding The gap left inside each edge of a layout, in whole pixels. .. note:: See :attr:`UI.Layout.padding`. .. attribute:: left: number The gap inside the left edge. :rtype: number .. attribute:: right: number The gap inside the right edge. :rtype: number .. attribute:: top: number The gap inside the top edge. :rtype: number .. attribute:: bottom: number The gap inside the bottom edge. :rtype: number .. class:: GridConstraint What fixes the shape of a grid layout. .. data:: flexible Fit as many columns and rows as the size of the panel allows. .. data:: fixed_column_count Use a fixed number of columns, and as many rows as are needed. .. data:: fixed_row_count Use a fixed number of rows, and as many columns as are needed.