S or /

SourceClass Popup

from egui import Popup
class Popup:

A popup container.

Methods§

Sourcedef align(self, /, align: RectAlign) -> Popup§

Set the RectAlign of the popup relative to the PopupAnchor. This is the default position, and will be used if it fits. See egui.Popup.align_alternatives for more on this.

Sourcedef align_alternatives(self, /, alternatives: Sequence[RectAlign]) -> Popup§

Set alternative positions to try if the default one doesn't fit. Set to an empty slice to always use the position you set with egui.Popup.align. By default, this will try RectAlign.symmetries and then RectAlign.MENU_ALIGNS.

Sourcedef anchor(self, /, anchor: PopupAnchor) -> Popup§

Show the popup relative to the given PopupAnchor.

Sourcedef at_pointer(self, /) -> Popup§

Show the popup relative to the pointer.

Sourcedef at_pointer_fixed(self, /) -> Popup§

Remember the pointer position at the time of opening the popup, and show the popup relative to that.

Sourcedef at_position(self, /, pos: Pos2) -> Popup§

Show the popup relative to a specific position.

Source@staticmethod def close_all(ctx: Context) -> None§

Close all currently open popups.

Sourcedef close_behavior(self, /, close_behavior: PopupCloseBehavior) -> Popup§

Set the close behavior of the popup.

This will do nothing if Popup.open was called.

Source@staticmethod def close_id(ctx: Context, popup_id: Id) -> None§

Close the given popup, if it is open.

See also egui.Popup.close_all if you want to close any / all currently open popups.

Source@staticmethod def context_menu(response: Response) -> Popup§

Show a context menu when the widget was secondary clicked. Sets the layout to Layout.top_down_justified(Align.Min). In contrast to egui.Popup.menu, this will open at the pointer position.

Sourcedef ctx(self, /) -> Context§

Get the Context

Source@staticmethod def default_response_id(response: Response) -> Id§

The default ID when constructing a popup from the Response of e.g. a button.

Sourcedef frame(self, /, frame: Frame) -> Popup§

Set the frame of the popup.

Source@staticmethod def from_response(response: Response) -> Popup§

Show a popup relative to some widget. The popup will be always open.

See egui.Popup.menu and egui.Popup.context_menu for common use cases.

Source@staticmethod def from_toggle_button_response(response: Response) -> Popup§

Show a popup relative to some widget, toggling the open state based on the widget's click state.

See egui.Popup.menu and egui.Popup.context_menu for common use cases.

Sourcedef gap(self, /, gap: float) -> Popup§

Set the gap between the anchor and the popup.

Sourcedef get_anchor(self, /) -> PopupAnchor§

Return the PopupAnchor of the popup.

Sourcedef get_anchor_rect(self, /) -> Rect |None§

Return the anchor rect of the popup.

Returns None if the anchor is PopupAnchor.Pointer and there is no pointer.

Sourcedef get_best_align(self, /) -> RectAlign§

Calculate the best alignment for the popup, based on the last size and screen rect.

Sourcedef get_expected_size(self, /) -> Vec2 |None§

Get the expected size of the popup.

Sourcedef get_id(self, /) -> Id§

Get the id of the popup.

Sourcedef get_popup_rect(self, /) -> Rect |None§

Get the expected rect the popup will be shown in.

Returns None if the popup wasn't shown before or anchor is PopupAnchor.Pointer and there is no pointer.

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

Set the id of the Area.

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

Set the UiStackInfo of the popup's Ui.

Source@staticmethod def is_any_open(ctx: Context) -> bool§

Is any popup open?

This assumes the egui memory is being used to track the open state of popups.

Source@staticmethod def is_id_open(ctx: Context, popup_id: Id) -> bool§

Is the given popup open?

This assumes the use of either: * egui.Popup.open_memory * egui.Popup.from_toggle_button_response * egui.Popup.menu * egui.Popup.context_menu

The popup id should be the same as either you set with egui.Popup.id or the default one from egui.Popup.default_response_id.

Sourcedef is_open(self, /) -> bool§

Is the popup open?

Sourcedef kind(self, /, kind: PopupKind) -> Popup§

Set the kind of the popup. Used for Area.kind and Area.order.

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

Set the layout of the popup.

Sourcedef open(self, /, open: bool) -> Popup§

Force the popup to be open or closed.

Source@staticmethod def open_id(ctx: Context, popup_id: Id) -> None§

Open the given popup and close all others.

Sourcedef open_memory(self, /, set_state: SetOpenCommand |None) -> Popup§

Store the open state via egui.Memory. You can set the state via the first SetOpenCommand param.

Source@staticmethod def position_of_id(ctx: Context, popup_id: Id) -> Pos2 |None§

Get the position for this popup, if it is open.

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

Set the sense of the popup.

Sourcedef show(self, /) -> Any§

Show the popup.

Returns None if the popup is not open or anchor is PopupAnchor.Pointer and there is no pointer.

Sourcedef style(self, /, style: StyleModifier) -> Popup§

Set the style for the popup contents.

Default: - is menu_style for egui.Popup.menu and egui.Popup.context_menu - is None otherwise

Source@staticmethod def toggle_id(ctx: Context, popup_id: Id) -> None§

Toggle the given popup between closed and open.

Note: At most, only one popup can be open at a time.

Sourcedef width(self, /, width: float) -> Popup§

The width that will be passed to Area.default_width.