Layouts¶
Layouts form containers to hold other elements.
Keep in mind that, although the base element Layout can be used in YAML, and is not as user friendly to use with it.
- class Layout¶
A layout collects elements, and creates an image out of them.
- Available shorthand actions are:
generate: Generates the element’s image data.update: Function to update an element via actions.
Element Properties
- property layout: list[str | int | float, tuple[Element, str | int | float]]
Required. The layout list.
- property accent_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None
- 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] | None
- 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 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 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 layout: list[str | int | float, tuple[Element, str | int | float]]
Required
- property accent_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None
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] | None
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 feedback_duration: duration
Optional, defaults to
0.75
- property outline_width: str | int | float
Optional, defaults to
0
- property radius: str | int | float
Optional, defaults to
0
layout, Required. The layout listaccent_color, Optional, defaults to"gray". Accent color to style child elements.background_color, Optional, defaults toNone. Color of the element background.foreground_color, Optional, defaults to"black". Foreground color to style child elementsoutline_color, Optional, defaults toNone. Color of the layout’s outline.hold_action, Optional, defaults toNone. The function called when the element is held.hold_release_action, Optional, defaults toNone. The function called when the element is released from being held down.tap_action, Optional, defaults toNone. The function called when the element is tapped.feedback_duration, Optional, defaults to0.75. Duration of the element’s feedback functionoutline_width, Optional, defaults to0. Width of the outline of the encompassing rectangleradius, Optional, defaults to0. Corner radius of the outlining rectangle
- class TileLayout¶
A general TileLayout, with self defined elements and layout.
- Available shorthand actions are:
generate: Generates the element’s image data.update: Function to update an element via actions.
Element Properties
- property elements: mappingproxy[str, Element]
Required. Elements in the layout. This property needs to be redefined for subclasses.
- 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 elements: mappingproxy[str, Element]
Required
- 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}
elements, Required. Elements in the layout.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 toNone. Color of the element background.foreground_color, Optional, defaults to"black". Foreground color to style child elementsoutline_color, Optional, defaults toNone. Color of the layout’s outline.hold_action, Optional, defaults toNone. The function called when the element is held.hold_release_action, Optional, defaults toNone. The function called when the element is released from being held down.tap_action, Optional, defaults toNone. The function called when the element is tapped.element_properties, Optional, defaults to{}. Dict with properties for each element.feedback_duration, Optional, defaults to0.75. Duration of the element’s feedback functionhorizontal_sizes, Optional, defaults to{'inner': 0, 'outer': 0}. Horizontal sizing of the tiles.outline_width, Optional, defaults to0. Width of the outline of the encompassing rectangleradius, Optional, defaults to0. Corner radius of the outlining rectanglevertical_sizes, Optional, defaults to{'inner': 0, 'outer': 0}. Vertical sizing of the tiles.
- class GridLayout¶
A Layout element that allows for easy placement of elements within a grid. Elements that are added to it (either at initialisation or via GridLayout.add_elements) will be given a grid_row and grid_column attribute with functionality to notify the GridLayout that their position changed. Elements do not need a value for grid_row and grid_column, in which case the GridLayout will attempt to place them later on in the leftover empty cells. Any elements that overflow the available number of grid cells, or have their grid_row and grid_column overlap with that of another Element will not be put in the Layout, but will be saved for new iterations of the GridLayout in case space becomes available. rows or columns can be set to None, in which case they will be set as needed by the number of elements. However, it is not allowed to set both to None.
- Available shorthand actions are:
generate: Generates the element’s image data.update: Function to update an element via actions.
Element Properties
- property elements: tuple[_GridElement]
Required. The list of elements assigned to this grid.
- property accent_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None
- 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] | None
- 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 column_sizes: list[str | int | float]
- Sizes of the columns. Either a list with the values of the corresponding column index, or a single value with the size for all columns.Optional, defaults to
"?"
- property columns: int | None
- The number of columns in the grid. If None, columns will be set as needed, provided rows is not None.Optional, defaults to
4
- 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 inner_margins: tuple[str | int | float, str | int | float, str | int | float, str | int | float]
- The values of the inner margins, parsed to a 4 tuple (i.e. the (top,right,bottom,left) margins respectively).Optional, defaults to
0
- property outer_margins: tuple[str | int | float, str | int | float, str | int | float, str | int | float]
- The values of the outer margins, parsed to a 4 tuple (i.e. the (top,right,bottom,left) margins respectively).Optional, defaults to
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 row_sizes: list[str | int | float]
- Sizes of the rows. Either a list with the values of the corresponding row index, or a single value with the size for all rows.Optional, defaults to
"?"
- property rows: int | None
- The number of rows in the grid. If None, rows will be set as needed, provided columns is not None.Optional, defaults to
4
- property elements: tuple[_GridElement]
Required
- property accent_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None
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] | None
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 column_sizes: list[str | int | float]
Optional, defaults to
"?"
- property columns: int | None
Optional, defaults to
4
- property feedback_duration: duration
Optional, defaults to
0.75
- property inner_margins: tuple[str | int | float, str | int | float, str | int | float, str | int | float]
Optional, defaults to
0
- property outer_margins: tuple[str | int | float, str | int | float, str | int | float, str | int | float]
Optional, defaults to
0
- property outline_width: str | int | float
Optional, defaults to
0
- property radius: str | int | float
Optional, defaults to
0
- property row_sizes: list[str | int | float]
Optional, defaults to
"?"
- property rows: int | None
Optional, defaults to
4
elements, Required. The list of elements assigned to this gridaccent_color, Optional, defaults to"gray". Accent color to style child elements.background_color, Optional, defaults toNone. Color of the element background.foreground_color, Optional, defaults to"black". Foreground color to style child elementsoutline_color, Optional, defaults toNone. Color of the layout’s outline.hold_action, Optional, defaults toNone. The function called when the element is held.hold_release_action, Optional, defaults toNone. The function called when the element is released from being held down.tap_action, Optional, defaults toNone. The function called when the element is tapped.column_sizes, Optional, defaults to"?". Sizes of the columns. Either a list with the values of the corresponding column index, or a single value with the size for all columnscolumns, Optional, defaults to4. The number of columns in the grid. If None, columns will be set as needed, provided rows is not Nonefeedback_duration, Optional, defaults to0.75. Duration of the element’s feedback functioninner_margins, Optional, defaults to0. The values of the inner margins, parsed to a 4 tuple (i.e. the (top,right,bottom,left) margins respectively)outer_margins, Optional, defaults to0. The values of the outer margins, parsed to a 4 tuple (i.e. the (top,right,bottom,left) margins respectively)outline_width, Optional, defaults to0. Width of the outline of the encompassing rectangleradius, Optional, defaults to0. Corner radius of the outlining rectanglerow_sizes, Optional, defaults to"?". Sizes of the rows. Either a list with the values of the corresponding row index, or a single value with the size for all rowsrows, Optional, defaults to4. The number of rows in the grid. If None, rows will be set as needed, provided columns is not None
- class TabPages¶
A layout that can hold multiple other elements (as tabs).
Comes with elements to cycle through the tab list, as well as a navigation bar that can be used to go to a specific tab. Generally, when referring to a page, an index (page number) is required. When referring to a tab, the tab name is required. The hide property has been restricted, and hiding the tab element is not permitted. Use hide_navigation_bar and hide_page_handles instead. Each entry in the navigation bar is made using a
NavigationTileAvailable element tiles are:navigation,handle-next,handle-previous,tab- Shorthand
tile_layoutvalues are: top:"navigation;[handle-previous,tab,handle-next]"bottom:"[handle-previous,tab,handle-next];navigation"left:"navigation,[tab;[handle-previous,handle-next]]"right:"[tab;[handle-previous,handle-next]],navigation"
- Available shorthand actions are:
generate: Generates the element’s image data.update: Function to update an element via actions.show-page: Function that can be used as a tap_action i.e. to show a page with a certain numbershow-tab: Helper function that can be used as an element’s tap_action to navigate to tab with the provided name, or other shorthands.next-page: Shows the next tab in the list of tabs. If cycle is not True and the last page is currently being shown, will do nothing.previous-page: Shows the previous tab in the list of tabs. If cycle is not True and the first page is currently being shown, will do nothing.
Element Properties
- property tabs: dict
Required. The dict with tab names and their config.
- 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 apply_default_sizes: bool
- If True, applies default sizes and orientations where needed, _if_ a default layout is used. Can be set to False to take (more) control of the element’s layout.Optional, defaults to
True
- 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
{}
- property navigation_tile_size: float | str | int
- The relative size to use for the Navigation Tile. Depending on the orientation, this will set the row height for the right and left default layouts, and the column width for the top and bottom layouts. If a float smaller than 0 is used, it will be parsed as h*val or w*val, depending on the above.Optional, defaults to
0.2
- 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 tile_layout: str | None
- String used to set the layout. None if the layout was set directly.Optional, defaults to
"bottom"
- 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
{}
- property tabs: dict
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 apply_default_sizes: bool
Optional, defaults to
True
- 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
{}
- property navigation_tile_size: float | str | int
Optional, defaults to
0.2
- property outline_width: str | int | float
Optional, defaults to
0
- property radius: str | int | float
Optional, defaults to
0
- property tile_layout: str | None
Optional, defaults to
"bottom"
- property vertical_sizes: dict[str, str | int | float]
Optional, defaults to
{}
tabs, Required. The dict with tab names and their configaccent_color, Optional, defaults to"gray". Accent color to style child elements.background_color, Optional, defaults toNone. Color of the element background.foreground_color, Optional, defaults to"black". Foreground color to style child elementsoutline_color, Optional, defaults toNone. Color of the layout’s outline.hold_action, Optional, defaults toNone. The function called when the element is held.hold_release_action, Optional, defaults toNone. The function called when the element is released from being held down.tap_action, Optional, defaults toNone. The function called when the element is tapped.apply_default_sizes, Optional, defaults toTrue. If True, applies default sizes and orientations where needed, _if_ a default layout is used. Can be set to False to take (more) control of the element’s layout.element_properties, Optional, defaults to{}. Dict with properties for each element.feedback_duration, Optional, defaults to0.75. Duration of the element’s feedback functionhorizontal_sizes, Optional, defaults to{}. Horizontal sizing of the tiles.navigation_tile_size, Optional, defaults to0.2. The relative size to use for the Navigation Tile.outline_width, Optional, defaults to0. Width of the outline of the encompassing rectangleradius, Optional, defaults to0. Corner radius of the outlining rectangletile_layout, Optional, defaults to"bottom". String used to set the layout.vertical_sizes, Optional, defaults to{}. Vertical sizing of the tiles.
- Shorthand
Useful Elements¶
The elements below are not a type of Layout per se, but they are mainly useful within one, and not so much on their own.
I also don’t know where else to put them really.
The navigation bar of a TabPages element is build up of NavigationTile elements.
Styled Tile Element to use with the TabPages. Used to show and select the tabs. Not quite fully developed since it’s not meant to be used as a standalone element. Comes with the special tile_layout ‘auto’, which means it sets its layout base on the layout of the parent TabPages Element.
Available element tiles are:icon,name,line- Available shorthand actions are:
generate: Generates the element’s image data.update: Function to update an element via actions.
Element Properties
- property tile_layout: LayoutString
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: LayoutString
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 toNone. Color of the element background.foreground_color, Optional, defaults to"black". Foreground color to style child elementsoutline_color, Optional, defaults toNone. Color of the layout’s outline.hold_action, Optional, defaults toNone. The function called when the element is held.hold_release_action, Optional, defaults toNone. The function called when the element is released from being held down.tap_action, Optional, defaults toNone. The function called when the element is tapped.element_properties, Optional, defaults to{}. Dict with properties for each element.feedback_duration, Optional, defaults to0.75. Duration of the element’s feedback functionhorizontal_sizes, Optional, defaults to{'inner': 0, 'outer': 0}. Horizontal sizing of the tiles.outline_width, Optional, defaults to0. Width of the outline of the encompassing rectangleradius, Optional, defaults to0. Corner radius of the outlining rectanglevertical_sizes, Optional, defaults to{'inner': 0, 'outer': 0}. Vertical sizing of the tiles.
If you want to seperate elements within layouts, the Line element can be used.
- class Line¶
A simple line element
- Available shorthand actions are:
generate: Generates the element’s image data.update: Function to update an element via actions.
Element Properties
- 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 line_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A]
- The color of the line.Optional, defaults to
"black"
- 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 alignment: Literal['center', 'top', 'bottom', 'left', 'right'] | str | int | float
- Alignment of the line relative to it’s area. top/bottom and left/right are adjusted respectively for the orientation. Has no affect when orientation is diagonal.Optional, defaults to
"center"
- 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 orientation: Literal['horizontal', 'vertical', 'diagonal1', 'diagonal2']
- Line orientation. Diagonal1 goes from top right to bottom left, diagonal2 goes from bottom right to top left.Optional, defaults to
"horizontal"
- property width: str | int | float
- Width of the line.Optional, defaults to
1
- property background_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None
Optional, defaults to
None
- property line_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A]
Optional, defaults to
"black"
- 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 alignment: Literal['center', 'top', 'bottom', 'left', 'right'] | str | int | float
Optional, defaults to
"center"
- property feedback_duration: duration
Optional, defaults to
0.75
- property orientation: Literal['horizontal', 'vertical', 'diagonal1', 'diagonal2']
Optional, defaults to
"horizontal"
- property width: str | int | float
Optional, defaults to
1
background_color, Optional, defaults toNone. Color of the element background.line_color, Optional, defaults to"black". The color of the linehold_action, Optional, defaults toNone. The function called when the element is held.hold_release_action, Optional, defaults toNone. The function called when the element is released from being held down.tap_action, Optional, defaults toNone. The function called when the element is tapped.alignment, Optional, defaults to"center". Alignment of the line relative to it’s area.feedback_duration, Optional, defaults to0.75. Duration of the element’s feedback functionorientation, Optional, defaults to"horizontal". Line orientation.width, Optional, defaults to1. Width of the line