Clocks

Two clock elements are provided by inkBoard, in addition to a date element that can be used to display dates.

class DigitalClock

A digital clock that updates at the start of each minute.

Can be styled similar to a Button, it simply has the functionality build in to show the time.

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 font_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A]
The color of the font.
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 elements outline. Set to None to use no outline (i.e. the background color).
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 fit_text: bool
Adjusts the font size automatically to make it fit. If true, font_size will be used as a minimum allowed font_size.
Optional, defaults to True
property font
The path to the element’s font. If set to a shorthand font, the path will automatically be parsed.
Optional, defaults to "clock"
property font_size: str | int | float
The size of the font.
Optional, defaults to "h*0.9"
property margins: tuple[int, int, int, int]
The text margins. Always returns a 4 tuple, but can be set to a single number, or two/three/four item iterable. Same as css margins, so the values are returned as (top,right,bottom,left), and set according to css margins (https://www.w3schools.com/css/css_margin.asp).
Optional, defaults to 0
property multiline: bool
Allows the button to try and fit its text over multiple lines. May not work very well with the settings that automatically set the font size.
Optional, defaults to False
property orientation: Literal['horizontal', 'vertical']
The orientation of the clock. If vertical, the time format string is altered to use be multiline. Any ‘:’ and spaces (’ ‘) are automatically replaced by a linebreak. So format %H:%M will become ‘%Hn%M’, i.e. the top line will be the hour and the bottom line will be the minute. Similarly, using ‘%-I:%M %p’ will become ‘%-In%Mn%p’, with the hour, minute and am/pm each on a new line.
Optional, defaults to "horizontal"
property outline_width: str | int | float
The width of the outline of the background rectangle.
Optional, defaults to 1
property radius: str | int | float
Corner radius of the encapsulating rectangle. Currently only accepts integers.
Optional, defaults to 0
property resize: bool | str | int | float
Tracks the font_size and adjusts it to fit. The resize value updates and will be used as a starting point for the next update. If not False, will use this value as a minimum allowed size for any text displayed. Changes the font_size parameter when needed, such that the text size won’t change with every new text. Sizes are not saved upon resets, so finding a good size takes a few changes. The same goes when the element is resized.
Optional, defaults to "H*0.036"
property text_anchor_alignment: tuple[Literal[None, 'l', 'm', 'r', 's'], Literal[None, 'a', 't', 'm', 's', 'b', 'd']]
Alignment of the textAnchor as (horizontal,vertical). Leave (one of) None to determine the anchor from text_x_position or text_y_position respectively. See https://pillow.readthedocs.io/en/stable/handbook/text-anchors.html#text-anchors for possible values, only accepts shorthands.
Optional, defaults to (None, None)
property text_x_position: int | Literal['l', 'm', 'r', 's']
Horizontal alignment of the text. Can be top, bottom or center, a Pillow textanchor (shorthand and longhand), a pssm dimensional string or an integer.
Optional, defaults to "center"
property text_y_position: int | Literal['a', 't', 'm', 's', 'b', 'd']
Vertical alignment of the text. Can be top, bottom or center, a Pillow textanchor (shorthand and longhand), a pssm dimensional string or an integer.
Optional, defaults to "center"
property time_format: str
Datetime format string to apply to the digital time. Default to %a (abbreviated day of the week).
Optional, defaults to "%H:%M"
property timezone: str | None
The timezone attached to this clock.
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 None

property font_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 feedback_duration: duration

Optional, defaults to 0.75

property fit_text: bool

Optional, defaults to True

property font

Optional, defaults to "clock"

property font_size: str | int | float

Optional, defaults to "h*0.9"

property margins: tuple[int, int, int, int]

Optional, defaults to 0

property multiline: bool

Optional, defaults to False

property orientation: Literal['horizontal', 'vertical']

Optional, defaults to "horizontal"

property outline_width: str | int | float

Optional, defaults to 1

property radius: str | int | float

Optional, defaults to 0

property resize: bool | str | int | float

Optional, defaults to "H*0.036"

property text_anchor_alignment: tuple[Literal[None, 'l', 'm', 'r', 's'], Literal[None, 'a', 't', 'm', 's', 'b', 'd']]

Optional, defaults to (None, None)

property text_x_position: int | Literal['l', 'm', 'r', 's']

Optional, defaults to "center"

property text_y_position: int | Literal['a', 't', 'm', 's', 'b', 'd']

Optional, defaults to "center"

property time_format: str

Optional, defaults to "%H:%M"

property timezone: str | None

Optional, defaults to None

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

  • font_color, Optional, defaults to "black". The color of the font

  • outline_color, Optional, defaults to None. Color of the elements 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.

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

  • fit_text, Optional, defaults to True. Adjusts the font size automatically to make it fit.

  • font, Optional, defaults to "clock". The path to the element’s font.

  • font_size, Optional, defaults to "h*0.9". The size of the font

  • margins, Optional, defaults to 0. The text margins.

  • multiline, Optional, defaults to False. Allows the button to try and fit its text over multiple lines.

  • orientation, Optional, defaults to "horizontal". The orientation of the clock. If vertical, the time format string is altered to use be multiline.

  • outline_width, Optional, defaults to 1. The width of the outline of the background rectangle

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

  • resize, Optional, defaults to "H*0.036". Tracks the font_size and adjusts it to fit. The resize value updates and will be used as a starting point for the next update.

  • text_anchor_alignment, Optional, defaults to (None, None). Alignment of the textAnchor as (horizontal,vertical).

  • text_x_position, Optional, defaults to "center". Horizontal alignment of the text.

  • text_y_position, Optional, defaults to "center". Vertical alignment of the text.

  • time_format, Optional, defaults to "%H:%M". Datetime format string to apply to the digital time. Default to %a (abbreviated day of the week)

  • timezone, Optional, defaults to None. The timezone attached to this clock

class AnalogueClock

An analogue clock (on a digital screen) that updates at the start of each minute.

It is quite stylable, most attributes allow to have their color set. It is also possible to show a digital time on the bottom.

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 clock_fill_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None
Background color of the clock.
Optional, defaults to None
property digital_color
Color of the digital time indicator.
Optional, defaults to None
property hour_hand_color
The color of the hour hand. Defaults to the outline color.
Optional, defaults to None
property minute_hand_color
The color of the minute hand. Defaults to the outline color.
Optional, defaults to None
property outline_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None
Color of the clock’s outline.
Optional, defaults to "black"
property tick_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A]
The color of the hour ticks. If None, will return the outline color.
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 digital_font: str
The font used for the digital time indicator.
Optional, defaults to "clock"
property digital_format: str
Datetime format string to apply to the digital time. Default to %a (abbreviated day of the week).
Optional, defaults to "%a"
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 minimum_resolution: int
The minimum resolution used to draw the clock. Increase this if the clock is pixelly.
Optional, defaults to 480
property outline_width: str | int | float
Width of the clock’s outline.
Optional, defaults to 5
property show_digital: bool
Show a text element on the clock showing a formatted time string based on the current time and date.
Optional, defaults to False
property timezone: str | None
The timezone attached to this clock.
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 None

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

Optional, defaults to None

property digital_color

Optional, defaults to None

property hour_hand_color

Optional, defaults to None

property minute_hand_color

Optional, defaults to None

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

Optional, defaults to "black"

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

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 digital_font: str

Optional, defaults to "clock"

property digital_format: str

Optional, defaults to "%a"

property feedback_duration: duration

Optional, defaults to 0.75

property minimum_resolution: int

Optional, defaults to 480

property outline_width: str | int | float

Optional, defaults to 5

property show_digital: bool

Optional, defaults to False

property timezone: str | None

Optional, defaults to None

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

  • clock_fill_color, Optional, defaults to None. Background color of the clock

  • digital_color, Optional, defaults to None. Color of the digital time indicator

  • hour_hand_color, Optional, defaults to None. The color of the hour hand. Defaults to the outline color

  • minute_hand_color, Optional, defaults to None. The color of the minute hand. Defaults to the outline color

  • outline_color, Optional, defaults to "black". Color of the clock’s outline

  • tick_color, Optional, defaults to None. The color of the hour ticks. If None, will return the outline color

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

  • digital_font, Optional, defaults to "clock". The font used for the digital time indicator

  • digital_format, Optional, defaults to "%a". Datetime format string to apply to the digital time. Default to %a (abbreviated day of the week)

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

  • minimum_resolution, Optional, defaults to 480. The minimum resolution used to draw the clock. Increase this if the clock is pixelly.

  • outline_width, Optional, defaults to 5. Width of the clock’s outline

  • show_digital, Optional, defaults to False. Show a text element on the clock showing a formatted time string based on the current time and date

  • timezone, Optional, defaults to None. The timezone attached to this clock

class DateElement

This element shows a date and updates at the top of every hour.

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 font_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A]
The color of the font.
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 elements outline. Set to None to use no outline (i.e. the background color).
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 date_format: str
The format string of the time.
Optional, defaults to "%Y-%m-%-d"
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 fit_text: bool
Adjusts the font size automatically to make it fit. If true, font_size will be used as a minimum allowed font_size.
Optional, defaults to True
property font
The path to the element’s font. If set to a shorthand font, the path will automatically be parsed.
Optional, defaults to "default-bold"
property font_size: str | int | float
The size of the font.
Optional, defaults to "h*0.9"
property margins: tuple[int, int, int, int]
The text margins. Always returns a 4 tuple, but can be set to a single number, or two/three/four item iterable. Same as css margins, so the values are returned as (top,right,bottom,left), and set according to css margins (https://www.w3schools.com/css/css_margin.asp).
Optional, defaults to 0
property multiline: bool
Allows the button to try and fit its text over multiple lines. May not work very well with the settings that automatically set the font size.
Optional, defaults to False
property outline_width: str | int | float
The width of the outline of the background rectangle.
Optional, defaults to 1
property radius: str | int | float
Corner radius of the encapsulating rectangle. Currently only accepts integers.
Optional, defaults to 0
property resize: bool | str | int | float
Tracks the font_size and adjusts it to fit. The resize value updates and will be used as a starting point for the next update. If not False, will use this value as a minimum allowed size for any text displayed. Changes the font_size parameter when needed, such that the text size won’t change with every new text. Sizes are not saved upon resets, so finding a good size takes a few changes. The same goes when the element is resized.
Optional, defaults to "H*0.036"
property text_anchor_alignment: tuple[Literal[None, 'l', 'm', 'r', 's'], Literal[None, 'a', 't', 'm', 's', 'b', 'd']]
Alignment of the textAnchor as (horizontal,vertical). Leave (one of) None to determine the anchor from text_x_position or text_y_position respectively. See https://pillow.readthedocs.io/en/stable/handbook/text-anchors.html#text-anchors for possible values, only accepts shorthands.
Optional, defaults to (None, None)
property text_x_position: int | Literal['l', 'm', 'r', 's']
Horizontal alignment of the text. Can be top, bottom or center, a Pillow textanchor (shorthand and longhand), a pssm dimensional string or an integer.
Optional, defaults to "center"
property text_y_position: int | Literal['a', 't', 'm', 's', 'b', 'd']
Vertical alignment of the text. Can be top, bottom or center, a Pillow textanchor (shorthand and longhand), a pssm dimensional string or an integer.
Optional, defaults to "center"
property timezone: str | None
The timezone attached to this clock.
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 None

property font_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 date_format: str

Optional, defaults to "%Y-%m-%-d"

property feedback_duration: duration

Optional, defaults to 0.75

property fit_text: bool

Optional, defaults to True

property font

Optional, defaults to "default-bold"

property font_size: str | int | float

Optional, defaults to "h*0.9"

property margins: tuple[int, int, int, int]

Optional, defaults to 0

property multiline: bool

Optional, defaults to False

property outline_width: str | int | float

Optional, defaults to 1

property radius: str | int | float

Optional, defaults to 0

property resize: bool | str | int | float

Optional, defaults to "H*0.036"

property text_anchor_alignment: tuple[Literal[None, 'l', 'm', 'r', 's'], Literal[None, 'a', 't', 'm', 's', 'b', 'd']]

Optional, defaults to (None, None)

property text_x_position: int | Literal['l', 'm', 'r', 's']

Optional, defaults to "center"

property text_y_position: int | Literal['a', 't', 'm', 's', 'b', 'd']

Optional, defaults to "center"

property timezone: str | None

Optional, defaults to None

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

  • font_color, Optional, defaults to "black". The color of the font

  • outline_color, Optional, defaults to None. Color of the elements 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.

  • date_format, Optional, defaults to "%Y-%m-%-d". The format string of the time

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

  • fit_text, Optional, defaults to True. Adjusts the font size automatically to make it fit.

  • font, Optional, defaults to "default-bold". The path to the element’s font.

  • font_size, Optional, defaults to "h*0.9". The size of the font

  • margins, Optional, defaults to 0. The text margins.

  • multiline, Optional, defaults to False. Allows the button to try and fit its text over multiple lines.

  • outline_width, Optional, defaults to 1. The width of the outline of the background rectangle

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

  • resize, Optional, defaults to "H*0.036". Tracks the font_size and adjusts it to fit. The resize value updates and will be used as a starting point for the next update.

  • text_anchor_alignment, Optional, defaults to (None, None). Alignment of the textAnchor as (horizontal,vertical).

  • text_x_position, Optional, defaults to "center". Horizontal alignment of the text.

  • text_y_position, Optional, defaults to "center". Vertical alignment of the text.

  • timezone, Optional, defaults to None. The timezone attached to this clock