SourceModule widgets
Widgets are pieces of GUI such as Label, Button, Slider etc.
Example widget uses:
* ui.add(egui.Label(egui.RichText("Text").color(egui.Color32.RED)))
* if ui.add(egui.Button("Click me")).clicked(): ...
Modules§
| color_picker | Color picker widgets. |
| text_edit | TextEdit, TextEditOutput, TextEditState, TextEditUndoer |
Classes§
| Button | Clickable button with text. |
| Checkbox | Boolean on/off control with text label. |
| DragValue | A numeric value that you can change by dragging the number. More compact than a |
| FrameDurations | Stores the durations between each frame of an animated image |
| Hyperlink | A clickable hyperlink, e.g. to |
| Image | A widget which displays an image. |
| ImageFit Enum | This type determines how the image should try to fit within the UI. |
| ImageOptions | |
| ImageSize | This type determines the constraints on how the size of an image should be calculated. |
| ImageSource Enum | This type tells the |
| Label | Static text. |
| Link | Clickable text, that looks like a hyperlink. |
| ProgressBar | A simple progress bar. |
| RadioButton | One out of several alternatives, either selected or not. |
| Separator | A visual separator. A horizontal or vertical line (depending on |
| Slider | Control a number with a slider. |
| SliderClamping Enum | Specifies how values in a |
| SliderOrientation Enum | Specifies the orientation of a |
| Spinner | A spinner widget used to indicate loading. |
Functions§
| decode_animated_image_uri | Extracts uri and frame index ErrorsWill return |
| global_theme_preference_buttons | Show a row of buttons for changing the theme of the whole app. |
| global_theme_preference_switch | Show a small button to switch to/from dark/light mode (globally). |
| has_gif_magic_header | Checks if bytes are gifs |
| has_webp_header | Checks if bytes are webp |
| paint_texture_at | |
| paint_texture_load_result | |
| reset_button | Show a button to reset a value to its default. The button is only enabled if the value does not already have its original value. |
| reset_button_with | Show a button to reset a value to its default. The button is only enabled if the value does not already have its original value. |
| texture_load_result_response | Attach tooltips like "Loading…" or "Failed loading: …". |
SourceFunction decode_animated_image_uri§
from egui import decode_animated_image_uridef decode_animated_image_uri(uri: str) -> tuple[str, int]Extracts uri and frame index
Errors
Will return Err if uri does not match pattern {uri}-{frame_index}
SourceFunction global_theme_preference_buttons§
from egui import global_theme_preference_buttonsdef global_theme_preference_buttons(ui: Ui) -> NoneShow a row of buttons for changing the theme of the whole app.
There is one button for each egui.ThemePreference:
dark mode, light mode, and following the system theme.
The button of the current preference is highlighted.
Each button is a small icon, so this fits in a top bar.
SourceFunction global_theme_preference_switch§
from egui import global_theme_preference_switchdef global_theme_preference_switch(ui: Ui) -> NoneShow a small button to switch to/from dark/light mode (globally).
This does not allow switching back to following the system theme,
which is why global_theme_preference_buttons is preferred.
SourceFunction has_gif_magic_header§
from egui import has_gif_magic_headerdef has_gif_magic_header(bytes: Any) -> boolChecks if bytes are gifs
SourceFunction has_webp_header§
from egui import has_webp_headerdef has_webp_header(bytes: Any) -> boolChecks if bytes are webp
SourceFunction paint_texture_at§
from egui import paint_texture_atdef paint_texture_at(painter: Painter, rect: Rect, options: ImageOptions, texture: SizedTexture) -> NoneSourceFunction paint_texture_load_result§
from egui import paint_texture_load_resultdef paint_texture_load_result(ui: Ui, rect: Rect, options: ImageOptions, texture_poll: TexturePoll |None = None, error: LoadError |None = None, show_loading_spinner: bool |None = None, alt_text: str |None = None) -> NoneSourceFunction reset_button§
from egui import reset_buttondef reset_button(ui: Ui, value: Mutable, text: str) -> NoneShow a button to reset a value to its default. The button is only enabled if the value does not already have its original value.
The text could be something like "Reset foo".
SourceFunction reset_button_with§
from egui import reset_button_withdef reset_button_with(ui: Ui, value: Mutable, text: str, reset_value: Any) -> NoneShow a button to reset a value to its default. The button is only enabled if the value does not already have its original value.
The text could be something like "Reset foo".
SourceFunction texture_load_result_response§
from egui import texture_load_result_responsedef texture_load_result_response(source: ImageSource, response: Response, texture_poll: TexturePoll |None = None, error: LoadError |None = None) -> ResponseAttach tooltips like "Loading…" or "Failed loading: …".