S or /

SourceClass Layout

from egui import Layout
class Layout:

Properties§

Source@property def cross_align(self, /) -> Align§
@cross_align.setter def cross_align(self, /, cross_align: Align) -> None§
Source@property def cross_justify(self, /) -> bool§
@cross_justify.setter def cross_justify(self, /, cross_justify: bool) -> None§
@property def main_align(self, /) -> Align§
@main_align.setter def main_align(self, /, main_align: Align) -> None§
Source@property def main_dir(self, /) -> Direction§
@main_dir.setter def main_dir(self, /, main_dir: Direction) -> None§
@property def main_justify(self, /) -> bool§
@main_justify.setter def main_justify(self, /, main_justify: bool) -> None§
Source@property def main_wrap(self, /) -> bool§
@main_wrap.setter def main_wrap(self, /, main_wrap: bool) -> None§

Methods§

Sourcedef align_size_within_rect(self, /, size: Vec2, outer: Rect) -> Rect§
Source@staticmethod def bottom_up(halign: Align) -> Layout§

Place elements vertically, bottom up.

Use the provided horizontal alignment.

Source@staticmethod def centered_and_justified(main_dir: Direction) -> Layout§

For when you want to add a single widget to a layout, and that widget should use up all available space.

Only one widget may be added to the inner Ui!

Source@staticmethod def from_main_dir_and_cross_align(main_dir: Direction, cross_align: Align) -> Layout§
Sourcedef horizontal_align(self, /) -> Align§

e.g. for when aligning text within a button.

Sourcedef horizontal_justify(self, /) -> bool§
Sourcedef horizontal_placement(self, /) -> Align§

e.g. for adjusting the placement of something. * in horizontal layout: left or right? * in vertical layout: same as egui.Layout.horizontal_align.

Sourcedef is_horizontal(self, /) -> bool§
Sourcedef is_vertical(self, /) -> bool§
Source@staticmethod def left_to_right(valign: Align) -> Layout§

Place elements horizontally, left to right.

The valign parameter controls how to align elements vertically.

Sourcedef prefer_right_to_left(self, /) -> bool§
Source@staticmethod def right_to_left(valign: Align) -> Layout§

Place elements horizontally, right to left.

The valign parameter controls how to align elements vertically.

Source@staticmethod def top_down(halign: Align) -> Layout§

Place elements vertically, top to bottom.

Use the provided horizontal alignment.

Source@staticmethod def top_down_justified(halign: Align) -> Layout§

Top-down layout justified so that buttons etc fill the full available width.

Sourcedef vertical_align(self, /) -> Align§

e.g. for when aligning text within a button.

Sourcedef vertical_justify(self, /) -> bool§
Sourcedef with_cross_align(self, /, cross_align: Align) -> Layout§

The alignment to use on the cross axis.

The "cross" axis is the one orthogonal to the main axis. For instance: in left-to-right layout, the main axis is horizontal and the cross axis is vertical.

Sourcedef with_cross_justify(self, /, cross_justify: bool) -> Layout§

Justify widgets along the cross axis?

Justify here means "take up all available space".

The "cross" axis is the one orthogonal to the main axis. For instance: in left-to-right layout, the main axis is horizontal and the cross axis is vertical.

Sourcedef with_main_align(self, /, main_align: Align) -> Layout§

The alignment to use on the main axis.

Sourcedef with_main_justify(self, /, main_justify: bool) -> Layout§

Justify widgets on the main axis?

Justify here means "take up all available space".

Sourcedef with_main_wrap(self, /, main_wrap: bool) -> Layout§

Wrap widgets when we overflow the main axis?

For instance, for left-to-right layouts, setting this to True will put widgets on a new row if we would overflow the right side of egui.Ui.max_rect.