Elements¶
Elements are the bricks that make up a dashboard. For an explantion of how to use them, refer to the tutorial section on elements. All elements will be documented as below. Meaning they should give a quick explantion as to what they are, list the available shorthand functions, and all settable properties. This is everything that should be required to use one in a YAML configuration, however if you want to use elements in custom functions, custom elements, or integrations, keep in mind this is not the full model. For that, refer to the API reference (which I will link once I’ve made it).
All elements have their configurable properties listed in three ways, depending on how much info you need. The Full tab gives all information on a property, meaning its typing, documentation string and default value. The Compact tab lists the typing and default value of a property. The List tab provides a consice list with the default value and a summary of the property.
Below is the base Element class. Every element is derived from it, so every action and property listed here is also available to other elements. Keep in mind though, usage may change for different elements.
This class cannot be used directly, it is not supposed to be. inkBoard will throw an error if it is specified as a type.
For the moment, images to show off the elements are not included yet. However, the example configuration.yaml in the inkBoarddesigner repo shows off all elements. You can run it if you want a preview at hand.
- class Element¶
Everything which is going to be displayed on the screen is an 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 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 background_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
background_color, Optional, defaults toNone. Color of the element background.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 function