S or /

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_editTextEdit, 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 egui.Slider.

FrameDurations

Stores the durations between each frame of an animated image

Hyperlink

A clickable hyperlink, e.g. to "https://github.com/emilk/egui".

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 Ui how to load an image.

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 egui.Layout).

Slider

Control a number with a slider.

SliderClamping Enum

Specifies how values in a Slider are clamped.

SliderOrientation Enum

Specifies the orientation of a Slider.

Spinner

A spinner widget used to indicate loading.

Functions§

decode_animated_image_uri

Extracts uri and frame index

Errors

Will return Err if uri does not match pattern {uri}-{frame_index}

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_uri
def 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_buttons
def global_theme_preference_buttons(ui: Ui) -> None

Show 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_switch
def global_theme_preference_switch(ui: Ui) -> None

Show 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_header
def has_gif_magic_header(bytes: Any) -> bool

Checks if bytes are gifs

SourceFunction has_webp_header§

from egui import has_webp_header
def has_webp_header(bytes: Any) -> bool

Checks if bytes are webp

SourceFunction paint_texture_at§

from egui import paint_texture_at
def paint_texture_at(painter: Painter, rect: Rect, options: ImageOptions, texture: SizedTexture) -> None

SourceFunction paint_texture_load_result§

from egui import paint_texture_load_result
def 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) -> None

SourceFunction reset_button§

from egui import reset_button
def reset_button(ui: Ui, value: Mutable, text: str) -> None

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.

The text could be something like "Reset foo".

SourceFunction reset_button_with§

from egui import reset_button_with
def reset_button_with(ui: Ui, value: Mutable, text: str, reset_value: Any) -> None

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.

The text could be something like "Reset foo".

SourceFunction texture_load_result_response§

from egui import texture_load_result_response
def texture_load_result_response(source: ImageSource, response: Response, texture_poll: TexturePoll |None = None, error: LoadError |None = None) -> Response

Attach tooltips like "Loading…" or "Failed loading: …".

Constants§

Re-exports§