Popups¶
Popup elements can be used to display information that you may not need at a glance. The can be the state of the device, or a weather forecast, for example.
- class Popup¶
A popup to be displayed above everything else.
Call its show function (show-popup) to display it. Optionally you can blur the background behind the popup. Use
widthandheightto set the popups size andhorizontal_positionandvertical_positionto set the position of the upper left corner.- Available shorthand actions are:
generate: Generates the element’s image data.update: Function to update an element via actions.show-popup: Shows the popup on screenclose-popup: Removes the popup from the screen
Element Properties
- 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
"white"
- 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 auto_close: duration
- The time with no interaction after which this popup is automatically closed. Set to False to disable. If True, it will use the default value of the screen instance.Optional, defaults to
True
- property blur_background: bool
- Blurs the dashboards behind the popup when it is shown. If true, when adding the popup to the screen, the background around it is blurred.Optional, defaults to
True
- 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 height: str | int | float
- The height of the popup.Optional, defaults to
"H*0.5"
- property horizontal_position: str | int | float
- x Postion off the popup’s upper left corner.Optional, defaults to
"(W-w)/2"
- property layout: list[str | int | float, tuple[Element, str | int | float]]
- The layout list.Optional, defaults to
[]
- property outline_width: str | int | float
- Width of the outline of the encompassing rectangle.Optional, defaults to
5
- property radius: str | int | float
- Corner radius of the outlining rectangle.Optional, defaults to
"H*0.05"
- property vertical_position: str | int | float
- y Position of the popups upper left corner.Optional, defaults to
"(H-h)/2"
- property width: str | int | float
- The width of the popup.Optional, defaults to
"W*0.8"
- 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
"white"
- 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 auto_close: duration
Optional, defaults to
True
- property blur_background: bool
Optional, defaults to
True
- property feedback_duration: duration
Optional, defaults to
0.75
- property height: str | int | float
Optional, defaults to
"H*0.5"
- property horizontal_position: str | int | float
Optional, defaults to
"(W-w)/2"
- property layout: list[str | int | float, tuple[Element, str | int | float]]
Optional, defaults to
[]
- property outline_width: str | int | float
Optional, defaults to
5
- property radius: str | int | float
Optional, defaults to
"H*0.05"
- property vertical_position: str | int | float
Optional, defaults to
"(H-h)/2"
- property width: str | int | float
Optional, defaults to
"W*0.8"
accent_color, Optional, defaults to"gray". Accent color to style child elements.background_color, Optional, defaults to"white". 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.auto_close, Optional, defaults toTrue. The time with no interaction after which this popup is automatically closed.blur_background, Optional, defaults toTrue. Blurs the dashboards behind the popup when it is shown.feedback_duration, Optional, defaults to0.75. Duration of the element’s feedback functionheight, Optional, defaults to"H*0.5". The height of the popuphorizontal_position, Optional, defaults to"(W-w)/2". x Postion off the popup’s upper left corner.layout, Optional, defaults to[]. The layout listoutline_width, Optional, defaults to5. Width of the outline of the encompassing rectangleradius, Optional, defaults to"H*0.05". Corner radius of the outlining rectanglevertical_position, Optional, defaults to"(H-h)/2". y Position of the popups upper left cornerwidth, Optional, defaults to"W*0.8". The width of the popup
- class PopupMenu¶
Base class for popup menus. Provides a title bar and close icon, and a layout to fill in the rest.
- Available shorthand actions are:
generate: Generates the element’s image data.update: Function to update an element via actions.show-popup: Shows the popup on screenclose-popup: Removes the popup from the screen
Element Properties
- property menu_layout: Layout
Required. The layout element that makes up the body of the popup.
- property title: str
Title of the menu
- 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
"white"
- property close_icon_color
- Color of the closing icon.Optional, defaults to
"white"
- 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 header_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A]
- Color of the header bar.Optional, defaults to
"steelblue"
- 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 title_color
- Color of the title text.Optional, defaults to
"white"
- 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 auto_close: duration
- The time with no interaction after which this popup is automatically closed. Set to False to disable. If True, it will use the default value of the screen instance.Optional, defaults to
True
- property blur_background: bool
- Blurs the dashboards behind the popup when it is shown. If true, when adding the popup to the screen, the background around it is blurred.Optional, defaults to
True
- property close_icon: str
Icon in the top right corner, closes the menu.
- 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 height: str | int | float
- The height of the popup.Optional, defaults to
"H*0.5"
- property horizontal_position: str | int | float
- x Postion off the popup’s upper left corner.Optional, defaults to
"(W-w)/2"
- property layout: list[str | int | float, tuple[Element, str | int | float]]
- The layout list.Optional, defaults to
[]
- property outline_width: str | int | float
- Width of the outline of the encompassing rectangle.Optional, defaults to
5
- property radius: str | int | float
- Corner radius of the outlining rectangle.Optional, defaults to
"H*0.05"
- property title_font: str
Font of the title
- property vertical_position: str | int | float
- y Position of the popups upper left corner.Optional, defaults to
"(H-h)/2"
- property width: str | int | float
- The width of the popup.Optional, defaults to
"W*0.8"
- property menu_layout: Layout
Required
- property title: str
Title of the menu
- 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
"white"
- property close_icon_color
Optional, defaults to
"white"
- property foreground_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None
Optional, defaults to
"black"
- property header_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A]
Optional, defaults to
"steelblue"
- property outline_color: str | int | list | tuple[L, A] | tuple[R, G, B] | tuple[R, G, B, A] | None
Optional, defaults to
None
- property title_color
Optional, defaults to
"white"
- 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 auto_close: duration
Optional, defaults to
True
- property blur_background: bool
Optional, defaults to
True
- property close_icon: str
Icon in the top right corner, closes the menu.
- property feedback_duration: duration
Optional, defaults to
0.75
- property height: str | int | float
Optional, defaults to
"H*0.5"
- property horizontal_position: str | int | float
Optional, defaults to
"(W-w)/2"
- property layout: list[str | int | float, tuple[Element, str | int | float]]
Optional, defaults to
[]
- property outline_width: str | int | float
Optional, defaults to
5
- property radius: str | int | float
Optional, defaults to
"H*0.05"
- property title_font: str
Font of the title
- property vertical_position: str | int | float
Optional, defaults to
"(H-h)/2"
- property width: str | int | float
Optional, defaults to
"W*0.8"
menu_layout, Required. The layout element that makes up the body of the popuptitle, Required. The title of the popup.accent_color, Optional, defaults to"gray". Accent color to style child elements.background_color, Optional, defaults to"white". Color of the element background.close_icon_color, Optional, defaults to"white". Color of the closing iconforeground_color, Optional, defaults to"black". Foreground color to style child elementsheader_color, Optional, defaults to"steelblue". Color of the header baroutline_color, Optional, defaults toNone. Color of the layout’s outline.title_color, Optional, defaults to"white". Color of the title texthold_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.auto_close, Optional, defaults toTrue. The time with no interaction after which this popup is automatically closed.blur_background, Optional, defaults toTrue. Blurs the dashboards behind the popup when it is shown.close_icon, Optional, defaults to"mdi:close-thick". The mdi icon to use for the button that closes the popupfeedback_duration, Optional, defaults to0.75. Duration of the element’s feedback functionheight, Optional, defaults to"H*0.5". The height of the popuphorizontal_position, Optional, defaults to"(W-w)/2". x Postion off the popup’s upper left corner.layout, Optional, defaults to[]. The layout listoutline_width, Optional, defaults to5. Width of the outline of the encompassing rectangleradius, Optional, defaults to"H*0.05". Corner radius of the outlining rectangletitle_font, Optional, defaults to"header". The font used for the popup titlevertical_position, Optional, defaults to"(H-h)/2". y Position of the popups upper left cornerwidth, Optional, defaults to"W*0.8". The width of the popup