CheckBoxes

inkBoard provides a couple of elements which take on a boolean state. These can best be seen as checkbox like elements, since they simply show whether they are checked or unchecked by changing the icon. Although currently all elements here are based on Icon, they will hopefully be extended in the future to include more types of elements.

class CheckBox

Checkbox element.

Derived from the base icon, accepts every option from Icon except icon, which is controlled by the state.

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

  • update: Function to update an element via actions.

  • set-state: Set the new state of the element.

  • toggle-state: Toggles the current state of the element

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 "white"
property icon_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | bool
Color of the icon. If a boolean and an mdi icon, the color is set automatically for best contrast. If an image file, a boolean of True will fill the image with the a contrasting color, and if False, will use the original image. Otherwise will use the provided value as color. I would advise against using booleans on screens that are not black and white.
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 on_set: Callable[[_BoolElement, bool], Any]
Action that is called whenever the box is checked/unchecked. Passed are the element itself, and a boolean with the new state (True for checked, False for unchecked).
Optional, defaults to None
property background_shape: Literal[None, 'circle', 'square', 'rounded_square', 'rounded_rectangle', 'octagon', 'hexagon', 'ADVANCED']
The shape of the element’s background. If not set, no shape is used and background color is used as the background color of the entire element of the area. Can be one of [“circle”, “square”, “rounded_square”, “rounded_rectangle”, “octagon”, “hexagon”], None or ADVANCED. See background_shapeDict for usage of advanced (Not fully tested, so be aware) Set to None for no background shape.
Optional, defaults to "rounded_rectangle"
property badge_icon: mdi:icon | None
The current icon of the badge. Must be None, an mdi icon or a PIL image instance.
Optional, defaults to None
property badge_location: Literal['UR', 'LR', 'UL', 'LL']
The location of the badge. Can be Can be one of UR, LR, UL or LL (Upper Right, Lower Right, Upper Left, Lower Left). Also accepts the fully written strings, but will be set to the abbreviated location.
Optional, defaults to None
property badge_offset: int
Badge Offset from the edges of the icon in pixels.
Optional, defaults to 0
property badge_settings: dict
Dict with settings to apply to the badge.
Optional, defaults to {}
property badge_size: float | None
Size of the badge relative to the parent icon. Must be between 0 and 1. If set to a percantage, will be converted to such a value.
Optional, defaults to None
property checked_icon: mdi:icon | str | None
The icon that indicates the CheckBox is checked.
Optional, defaults to "mdi:check"
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 force_aspect: bool
Forces the aspect ratio of the icon to fit.
Optional, defaults to True
property icon: mdi:icon | str
The current icon of the element.
Optional, defaults to "mdi:sticker-outline"
property interactive: bool
If true, tapping the element will toggle its state.
Optional, defaults to True
property invert_icon: bool
Inverts only the icon, not the entier element. This works seperately from isInverted, which inverts an entire element, and is applicable to all elements. invert_icon is only applicable for icons, mainly to provide a way to give images which do not have a solid color (like filled meteocons) more contrast without being confined to a single colored icon.
Optional, defaults to False
property mirrored: bool
Mirrors the icon.
Optional, defaults to False
property shape_settings: dict
Settings for the background shape. Advanced setting, generally best to leave it as an emtpy dict. Stuff may not work as intended as I cannot test everything. Optional arguments are required using ADVANCED, except for icon_coords (icon will default to being centered). The following keys can be used:: method the ImageDraw method to call. Only used if background_shape is "ADVANCED"; icon_size the size of the icon. Accepts dimensional strings; icon_coords the center coordinates of the icon in case of an mdi icon. The upper left corner is used if an image is used as an icon; drawArgs a dict with arguments to pass to the ImageDraw function. Rather advanced method, don’t use it if you don’t know what you’re up to;
Optional, defaults to {}
property state_attributes: CheckStateDict
Element attributes to change depending on the checked state.
Optional, defaults to {True: {}, False: {}}
property unchecked_icon: mdi:icon | str | None
The icon that indicates the CheckBox is not checked.
Optional, defaults to None
property background_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None

Optional, defaults to "white"

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

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 on_set: Callable[[_BoolElement, bool], Any]

Optional, defaults to None

property background_shape: Literal[None, 'circle', 'square', 'rounded_square', 'rounded_rectangle', 'octagon', 'hexagon', 'ADVANCED']

Optional, defaults to "rounded_rectangle"

property badge_icon: mdi:icon | None

Optional, defaults to None

property badge_location: Literal['UR', 'LR', 'UL', 'LL']

Optional, defaults to None

property badge_offset: int

Optional, defaults to 0

property badge_settings: dict

Optional, defaults to {}

property badge_size: float | None

Optional, defaults to None

property checked_icon: mdi:icon | str | None

Optional, defaults to "mdi:check"

property feedback_duration: duration

Optional, defaults to 0.75

property force_aspect: bool

Optional, defaults to True

property icon: mdi:icon | str

Optional, defaults to "mdi:sticker-outline"

property interactive: bool

Optional, defaults to True

property invert_icon: bool

Optional, defaults to False

property mirrored: bool

Optional, defaults to False

property shape_settings: dict

Optional, defaults to {}

property state_attributes: CheckStateDict

Optional, defaults to {True: {}, False: {}}

property unchecked_icon: mdi:icon | str | None

Optional, defaults to None

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

  • icon_color, Optional, defaults to "black". Color of the icon.

  • 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.

  • on_set, Optional, defaults to None. Action that is called whenever the box is checked/unchecked.

  • background_shape, Optional, defaults to "rounded_rectangle". The shape of the element’s background.

  • badge_icon, Optional, defaults to None. The current icon of the badge.

  • badge_location, Optional, defaults to None. The location of the badge.

  • badge_offset, Optional, defaults to 0. Badge Offset from the edges of the icon in pixels

  • badge_settings, Optional, defaults to {}. Dict with settings to apply to the badge

  • badge_size, Optional, defaults to None. Size of the badge relative to the parent icon.

  • checked_icon, Optional, defaults to "mdi:check". The icon that indicates the CheckBox is checked

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

  • force_aspect, Optional, defaults to True. Forces the aspect ratio of the icon to fit.

  • icon, Optional, defaults to "mdi:sticker-outline". The current icon of the element

  • interactive, Optional, defaults to True. If true, tapping the element will toggle its state

  • invert_icon, Optional, defaults to False. Inverts only the icon, not the entier element.

  • mirrored, Optional, defaults to False. Mirrors the icon

  • shape_settings, Optional, defaults to {}. Settings for the background shape.

  • state_attributes, Optional, defaults to {True: {}, False: {}}. Element attributes to change depending on the checked state

  • unchecked_icon, Optional, defaults to None. The icon that indicates the CheckBox is not checked

class Toggle

CheckBox element, but with a toggle switch as icon.

So basically the same as a CheckBox with checked_icon = mdi:toggle-switch and unchecked_icon = mdi:toggle-switch-off)

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

  • update: Function to update an element via actions.

  • set-state: Set the new state of the element.

  • toggle-state: Toggles the current state of the element

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 "white"
property icon_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | bool
Color of the icon. If a boolean and an mdi icon, the color is set automatically for best contrast. If an image file, a boolean of True will fill the image with the a contrasting color, and if False, will use the original image. Otherwise will use the provided value as color. I would advise against using booleans on screens that are not black and white.
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 on_set: Callable[[_BoolElement, bool], Any]
Action that is called whenever the box is checked/unchecked. Passed are the element itself, and a boolean with the new state (True for checked, False for unchecked).
Optional, defaults to None
property background_shape: Literal[None, 'circle', 'square', 'rounded_square', 'rounded_rectangle', 'octagon', 'hexagon', 'ADVANCED']
The shape of the element’s background. If not set, no shape is used and background color is used as the background color of the entire element of the area. Can be one of [“circle”, “square”, “rounded_square”, “rounded_rectangle”, “octagon”, “hexagon”], None or ADVANCED. See background_shapeDict for usage of advanced (Not fully tested, so be aware) Set to None for no background shape.
Optional, defaults to "rounded_rectangle"
property badge_icon: mdi:icon | None
The current icon of the badge. Must be None, an mdi icon or a PIL image instance.
Optional, defaults to None
property badge_location: Literal['UR', 'LR', 'UL', 'LL']
The location of the badge. Can be Can be one of UR, LR, UL or LL (Upper Right, Lower Right, Upper Left, Lower Left). Also accepts the fully written strings, but will be set to the abbreviated location.
Optional, defaults to None
property badge_offset: int
Badge Offset from the edges of the icon in pixels.
Optional, defaults to 0
property badge_settings: dict
Dict with settings to apply to the badge.
Optional, defaults to {}
property badge_size: float | None
Size of the badge relative to the parent icon. Must be between 0 and 1. If set to a percantage, will be converted to such a value.
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 force_aspect: bool
Forces the aspect ratio of the icon to fit.
Optional, defaults to True
property icon: mdi:icon | str
The current icon of the element.
Optional, defaults to "mdi:sticker-outline"
property interactive: bool
If true, tapping the element will toggle its state.
Optional, defaults to True
property invert_icon: bool
Inverts only the icon, not the entier element. This works seperately from isInverted, which inverts an entire element, and is applicable to all elements. invert_icon is only applicable for icons, mainly to provide a way to give images which do not have a solid color (like filled meteocons) more contrast without being confined to a single colored icon.
Optional, defaults to False
property mirrored: bool
Mirrors the icon.
Optional, defaults to False
property shape_settings: dict
Settings for the background shape. Advanced setting, generally best to leave it as an emtpy dict. Stuff may not work as intended as I cannot test everything. Optional arguments are required using ADVANCED, except for icon_coords (icon will default to being centered). The following keys can be used:: method the ImageDraw method to call. Only used if background_shape is "ADVANCED"; icon_size the size of the icon. Accepts dimensional strings; icon_coords the center coordinates of the icon in case of an mdi icon. The upper left corner is used if an image is used as an icon; drawArgs a dict with arguments to pass to the ImageDraw function. Rather advanced method, don’t use it if you don’t know what you’re up to;
Optional, defaults to {}
property state_attributes: CheckStateDict
Element attributes to change depending on the checked state.
Optional, defaults to {True: {}, False: {}}
property background_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None

Optional, defaults to "white"

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

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 on_set: Callable[[_BoolElement, bool], Any]

Optional, defaults to None

property background_shape: Literal[None, 'circle', 'square', 'rounded_square', 'rounded_rectangle', 'octagon', 'hexagon', 'ADVANCED']

Optional, defaults to "rounded_rectangle"

property badge_icon: mdi:icon | None

Optional, defaults to None

property badge_location: Literal['UR', 'LR', 'UL', 'LL']

Optional, defaults to None

property badge_offset: int

Optional, defaults to 0

property badge_settings: dict

Optional, defaults to {}

property badge_size: float | None

Optional, defaults to None

property feedback_duration: duration

Optional, defaults to 0.75

property force_aspect: bool

Optional, defaults to True

property icon: mdi:icon | str

Optional, defaults to "mdi:sticker-outline"

property interactive: bool

Optional, defaults to True

property invert_icon: bool

Optional, defaults to False

property mirrored: bool

Optional, defaults to False

property shape_settings: dict

Optional, defaults to {}

property state_attributes: CheckStateDict

Optional, defaults to {True: {}, False: {}}

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

  • icon_color, Optional, defaults to "black". Color of the icon.

  • 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.

  • on_set, Optional, defaults to None. Action that is called whenever the box is checked/unchecked.

  • background_shape, Optional, defaults to "rounded_rectangle". The shape of the element’s background.

  • badge_icon, Optional, defaults to None. The current icon of the badge.

  • badge_location, Optional, defaults to None. The location of the badge.

  • badge_offset, Optional, defaults to 0. Badge Offset from the edges of the icon in pixels

  • badge_settings, Optional, defaults to {}. Dict with settings to apply to the badge

  • badge_size, Optional, defaults to None. Size of the badge relative to the parent icon.

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

  • force_aspect, Optional, defaults to True. Forces the aspect ratio of the icon to fit.

  • icon, Optional, defaults to "mdi:sticker-outline". The current icon of the element

  • interactive, Optional, defaults to True. If true, tapping the element will toggle its state

  • invert_icon, Optional, defaults to False. Inverts only the icon, not the entier element.

  • mirrored, Optional, defaults to False. Mirrors the icon

  • shape_settings, Optional, defaults to {}. Settings for the background shape.

  • state_attributes, Optional, defaults to {True: {}, False: {}}. Element attributes to change depending on the checked state