S or /

SourceClass Area

from egui import Area
class Area:

An area on the screen that can be moved by dragging.

This forms the base of the egui.Window container.

The previous rectangle used by this area can be obtained through egui.Memory.area_rect().

Methods§

Sourcedef anchor(self, /, align: Align2, offset: Vec2) -> Area§

Set anchor and distance.

An anchor of Align2.RIGHT_TOP means "put the right-top corner of the window in the right-top corner of the screen".

The offset is added to the position, so e.g. an offset of [-5.0, 5.0] would move the window left and down from the given anchor.

Anchoring also makes the window immovable.

It is an error to set both an anchor and a position.

Sourcedef constrain(self, /, constrain: bool) -> Area§

Constrains this area to Context.content_rect?

Default: True.

Sourcedef constrain_to(self, /, rect: Rect) -> Area§

Constrain the movement of the window to the given rectangle.

For instance: .constrain_to(ctx.content_rect()).

Sourcedef current_pos(self, /, pos: Pos2) -> Area§

Positions the window but you can still move it.

Sourcedef default_height(self, /, height: float) -> Area§
Sourcedef default_pos(self, /, pos: Pos2) -> Area§
Sourcedef default_size(self, /, size: Vec2) -> Area§

The size used for the Ui.max_rect the first frame.

Text will wrap at this width, and images that expand to fill the available space will expand to this size.

If the contents are smaller than this size, the area will shrink to fit the contents. If the contents overflow, the area will grow.

If not set, egui.style.Spacing.default_area_size will be used.

Sourcedef default_width(self, /, width: float) -> Area§
Sourcedef enabled(self, /, enabled: bool) -> Area§

If false, no content responds to click and widgets will be shown grayed out. You won't be able to move the window. Default: True.

Sourcedef fade_in(self, /, fade_in: bool) -> Area§

If True, quickly fade in the area.

Default: True.

Sourcedef fixed_pos(self, /, pos: Pos2) -> Area§

Positions the window and prevents it from being moved

Sourcedef id(self, /, id: Id) -> Area§

Let's you change the id that you assigned in egui.Area().

The id must be globally unique.

Sourcedef info(self, /, info: UiStackInfo) -> Area§

Set the UiStackInfo of the area's Ui.

Default to UiStackInfo with kind UiKind.GenericArea.

Sourcedef interactable(self, /, interactable: bool) -> Area§

If false, clicks goes straight through to what is behind us.

Can be used for semi-invisible areas that the user should be able to click through.

Default: True.

Sourcedef is_enabled(self, /) -> bool§
Sourcedef is_movable(self, /) -> bool§
Sourcedef kind(self, /, kind: UiKind) -> Area§

Change the UiKind of the arena.

Default to UiKind.GenericArea.

Sourcedef layer(self, /) -> LayerId§
Sourcedef layout(self, /, layout: Layout) -> Area§

Set the layout for the child Ui.

Sourcedef movable(self, /, movable: bool) -> Area§

Moveable by dragging the area?

Sourcedef order(self, /, order: Order) -> Area§

order(Order.Foreground) for an Area that should always be on top

Sourcedef pivot(self, /, pivot: Align2) -> Area§

Where the "root" of the area is.

For instance, if you set this to Align2.RIGHT_TOP then egui.Area.fixed_pos will set the position of the right-top corner of the area.

Default: Align2.LEFT_TOP.

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

Explicitly set a sense.

If not set, this will default to Sense.drag() if movable, Sense.click() if interactable, and Sense.hover() otherwise.

Sourcedef show(self, /, ctx: Context) -> Any§
Sourcedef sizing_pass(self, /, resize: bool) -> Area§

While true, a sizing pass will be done. This means the area will be invisible and the contents will be laid out to estimate the proper containing size of the area. If false, there will be no change to the default area behavior. This is useful if the area contents area dynamic and you need to need to make sure the area adjusts its size accordingly.

This should only be set to true during the specific frames you want force a sizing pass. Do NOT hard-code this as .sizing_pass(True), as it will cause the area to never be visible.

Arguments

  • resize: If true, the area will be resized to fit its contents. False will keep the default area resizing behavior.

Default: False.