Base Elements

These elements are not directly usable, but provide the basis for various element types. This page is meant as a quick reference when developing, although currently it omits a lot of entries which are not settable, so its usefulness may be low.

class TileElement

Base element for Tile based element functionality. Provides base functionality for using layout strings and using color shorthands (the latter has by now been extended to layouts in general). Cannot be used as is, needs to be called from a childclass. The elements need to have been set before calling the init of the _TileBase.

Available shorthand actions are:
  • generate: Generates the element’s image data.

  • update: Function to update an element via actions.

Element Properties

property tile_layout: str | None

Required. String used to set the layout. None if the layout was set directly.

property accent_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A]
Accent color to style child elements. Not inherently used in the layout itself, but can be used in child elements, to give them a uniform style Set a color_property of one to “accent” to do so.
Optional, defaults to "gray"
property background_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None
Color of the element background.
Optional, defaults to None
property foreground_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A]
Foreground color to style child elements Additional color property for Layouts. Not inherently used in the layout itself, but can be used in child elements, to give them a uniform style. Set a color_property of one to “foreground” to do so.
Optional, defaults to "black"
property outline_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None
Color of the layout’s outline. Set to None to use no outline.
Optional, defaults to None
property hold_action: str | Callable[[Element, InteractEvent, Any], Any] | None
The function called when the element is held. Set to None to have nothing called. If set to a dict, the values for hold_action_data and hold_action_map will be overwritten if the respective key is present.
Optional, defaults to None
property hold_release_action: str | Callable[[Element, InteractEvent, Any], Any] | None
The function called when the element is released from being held down. This function is only available on devices with the HOLD_RELEASE feature. Set to None to have nothing called. If set to a dict, the values for hold_release_action_data and hold_release_action_map will be overwritten if the respective key is present.
Optional, defaults to None
property tap_action: str | Callable[[Element, InteractEvent, Any], Any] | None
The function called when the element is tapped. Set to None to have nothing called. If set to a dict, the values for tap_action_data and tap_action_map will be overwritten if the respective key is present.
Optional, defaults to None
property element_properties: dict[str, dict]
Dict with properties for each element. Accepts parsing colors. Use as nested dicts, the first key specifying the element tag, with the dict within denoting the properties to set.
Optional, defaults to {}
property feedback_duration: duration
Duration of the element’s feedback function The time an element will stay in ‘feedback state’, before returning to its normal state. Can be set to a string, which will be parsed to the right amount of seconds.
Optional, defaults to 0.75
property horizontal_sizes: dict[str, str | int | float]
Horizontal sizing of the tiles. Setting this will update from the current values, not overwrite it.
Optional, defaults to {'inner': 0, 'outer': 0}
property outline_width: str | int | float
Width of the outline of the encompassing rectangle.
Optional, defaults to 0
property radius: str | int | float
Corner radius of the outlining rectangle.
Optional, defaults to 0
property vertical_sizes: dict[str, str | int | float]
Vertical sizing of the tiles. Setting this will update from the current values, not overwrite it.
Optional, defaults to {'inner': 0, 'outer': 0}
property tile_layout: str | None

Required

property accent_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A]

Optional, defaults to "gray"

property background_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None

Optional, defaults to None

property foreground_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A]

Optional, defaults to "black"

property outline_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None

Optional, defaults to None

property hold_action: str | Callable[[Element, InteractEvent, Any], Any] | None

Optional, defaults to None

property hold_release_action: str | Callable[[Element, InteractEvent, Any], Any] | None

Optional, defaults to None

property tap_action: str | Callable[[Element, InteractEvent, Any], Any] | None

Optional, defaults to None

property element_properties: dict[str, dict]

Optional, defaults to {}

property feedback_duration: duration

Optional, defaults to 0.75

property horizontal_sizes: dict[str, str | int | float]

Optional, defaults to {'inner': 0, 'outer': 0}

property outline_width: str | int | float

Optional, defaults to 0

property radius: str | int | float

Optional, defaults to 0

property vertical_sizes: dict[str, str | int | float]

Optional, defaults to {'inner': 0, 'outer': 0}

  • tile_layout, Required. String used to set the layout.

  • accent_color, Optional, defaults to "gray". Accent color to style child elements.

  • background_color, Optional, defaults to None. Color of the element background.

  • foreground_color, Optional, defaults to "black". Foreground color to style child elements

  • outline_color, Optional, defaults to None. Color of the layout’s outline.

  • hold_action, Optional, defaults to None. The function called when the element is held.

  • hold_release_action, Optional, defaults to None. The function called when the element is released from being held down.

  • tap_action, Optional, defaults to None. The function called when the element is tapped.

  • element_properties, Optional, defaults to {}. Dict with properties for each element.

  • feedback_duration, Optional, defaults to 0.75. Duration of the element’s feedback function

  • horizontal_sizes, Optional, defaults to {'inner': 0, 'outer': 0}. Horizontal sizing of the tiles.

  • outline_width, Optional, defaults to 0. Width of the outline of the encompassing rectangle

  • radius, Optional, defaults to 0. Corner radius of the outlining rectangle

  • vertical_sizes, Optional, defaults to {'inner': 0, 'outer': 0}. Vertical sizing of the tiles.