SourceClass ComboBox
from egui import ComboBoxclass ComboBox:A drop-down selection menu with a descriptive label.
Methods§
Sourcedef close_behavior(self, /, close_behavior: PopupCloseBehavior) -> ComboBox§
Controls the close behavior for the popup.
By default, PopupCloseBehavior.CloseOnClick will be used.
Source@staticmethod
def from_id_salt(id_salt: str) -> ComboBox§
Without label.
@staticmethod
def from_id_source(id_source: str) -> ComboBox§
Source@staticmethod
def from_label(label: Any) -> ComboBox§
Label shown next to the combo box
Sourcedef height(self, /, height: float) -> ComboBox§
Set the maximum outer height of the menu.
Default is Spacing.combo_height.
Source@staticmethod
def is_open(ctx: Context, id: Id) -> bool§
Check if the ComboBox with the given id has its popup menu currently opened.
Sourcedef popup_style(self, /, popup_style: StyleModifier) -> ComboBox§
Set the style of the popup menu.
Could for example be used with egui.containers.menu.menu_style to get the frame-less
menu button style.
Sourcedef selected_text(self, /, selected_text: Any) -> ComboBox§
What we show as the currently selected value
def show(self, /) -> Any§
To show the combo box, call .show() wrapped within async with (...) as combo_box:. You can use another variable name instead of combo_box.
You can use combo_box.shown to check if the combo box is being shown and combo_box.ui to access a ui that can be used to show widgets inside the combo box.
One way to show an option inside a combo box is with combo_box.ui.selectable_value().
Sourcedef show_index(self, /, ui: Ui, selected: Mutable, alternatives: Sequence[str]) -> Response§
Show a list of items with the given selected index.
Sourcedef show_ui(self, /) -> Any§
Show the combo box, with the given ui code for the menu contents.
Returns InnerResponse { inner: None } if the combo box is closed.
Sourcedef truncate(self, /) -> ComboBox§
Sourcedef width(self, /, width: float) -> ComboBox§
Set the outer width of the button and menu.
Default is Spacing.combo_width.
Sourcedef wrap(self, /) -> ComboBox§
Sourcedef wrap_mode(self, /, wrap_mode: TextWrapMode) -> ComboBox§
Controls the wrap mode used for the selected text.
By default, Ui.wrap_mode will be used, which can be overridden with egui.Style.wrap_mode.
Note that any \n in the text will always produce a new line.