S or /

SourceClass UiBuilder

from egui import UiBuilder
class UiBuilder:

The properties specified when creating a top-level or child Ui.

By default, everything is inherited from the parent, except for max_rect which by default is set to the parent Ui.available_rect_before_wrap.

See also Ui() and Ui.new_child for uses.

Properties§

@property def classes(self, /) -> Classes§
@classes.setter def classes(self, /, classes: Classes) -> None§
@property def id_source(self, /) -> IdSource |None§
@id_source.setter def id_source(self, /, id_source: IdSource |None) -> None§

Methods§

Sourcedef accessibility_parent(self, /, parent_id: Id) -> UiBuilder§

Set the accessibility parent for this Ui.

Pass Ui.unique_id or Response.id, not Ui.scope_id.

This will override the automatic parent assignment for accessibility purposes. If not set, the parent Ui's ID will be used as the accessibility parent.

Sourcedef closable(self, /) -> UiBuilder§

Make this Ui closable.

Calling Ui.close in a child Ui will mark this Ui for closing. After Ui.close was called, Ui.should_close and egui.Response.should_close will return True (for this frame).

This works by adding a ClosableTag to the UiStackInfo.

@staticmethod def default() -> UiBuilder§
Sourcedef disabled(self, /) -> UiBuilder§

Make the new Ui disabled, i.e. grayed-out and non-interactive.

Note that if the parent Ui is disabled, the child will always be disabled.

See also egui.Ui.add_enabled, egui.Ui.add_enabled_ui and egui.Ui.is_enabled.

Sourcedef id(self, /, id: Id) -> UiBuilder§
Sourcedef id_salt(self, /, id_salt: str) -> UiBuilder§

Seed the child Ui with this id_salt, which will be mixed with the Ui.scope_id of the parent.

You should give each Ui an id_salt that is unique within the parent, or give it none at all.

Sourcedef invisible(self, /) -> UiBuilder§

Make the contents invisible.

Will also disable the Ui (see egui.UiBuilder.disabled).

If the parent Ui is invisible, the child will always be invisible.

Sourcedef layer_id(self, /, layer_id: LayerId) -> UiBuilder§

Show the Ui in a different LayerId from its parent.

Sourcedef layout(self, /, layout: Layout) -> UiBuilder§

Override the layout.

Will otherwise be inherited from the parent.

Sourcedef max_rect(self, /, max_rect: Rect) -> UiBuilder§

Set the max rectangle, within which widgets will go.

New widgets will try to fit within this rectangle.

Text labels will wrap to fit within max_rect. Separator lines will span the max_rect.

If a new widget doesn't fit within the max_rect then the Ui will make room for it by expanding both min_rect and

If not set, this will be set to the parent Ui.available_rect_before_wrap.

Sourcedef sense(self, /, sense: Sense) -> UiBuilder§

Set if you want sense clicks and/or drags. Default is Sense.hover.

The sense will be registered below the Senses of any widgets contained in this Ui, so if the user clicks a button contained within this Ui, that button will receive the click instead.

The response can be read early with Ui.response.

Sourcedef sizing_pass(self, /) -> UiBuilder§

Set to true in special cases where we do one frame where we size up the contents of the Ui, without actually showing it.

If the sizing_pass flag is set on the parent, the child will inherit it automatically.

Sourcedef style(self, /, style: Style) -> UiBuilder§

Override the style.

Otherwise will inherit the style of the parent.

Sourcedef ui_stack_info(self, /, ui_stack_info: UiStackInfo) -> UiBuilder§

Provide some information about the new Ui being built.

def with_class(self, /, class: str) -> UiBuilder§
def with_class_if(self, /, class: str, condition: bool) -> UiBuilder§