Skip to content

Icon class

Small image in the User Interface.

Icons are typically used in controls like button or items in a menu.

If a text is associated to an icon, it is rendered by the visual elements that uses this Icon.

Methods

__init__()

__init__(
    path: str,
    text: t.Optional[str] = None,
    light_path: t.Optional[str] = None,
    dark_path: t.Optional[str] = None,
) -> None

Initialize a new Icon.

Parameters:

Name Type Description Default
path str

The path to an image file.
This path must be relative to and inside the root directory of the application (where the Python file that created the Gui instance is located).
In situations where the image file is located outside the application directory, a path mapping must be used: the path_mapping parameter of the Gui constructor makes it possible to access a resource anywhere on the server filesystem, as if it were located in a subdirectory of the application directory.

required
text Optional[str]

The text associated to the image. If text is None, there is no text associated to this image.

None
light_path Optional[str]

The path to the light theme image (fallback to path if not defined).

None
dark_path Optional[str]

The path to the dark theme image (fallback to path if not defined).

None