Tooltip
Introduction
Tooltip
widget in Supervisely is a user interface element that displays prompt information for mouse hover. Uses like a wrapper around a main UI elements, such as Button
for example.
Function signature
Parameters
text
Tooltip text. For a multi-line view, use List[str]
with each line as a value in the list
type: Union[str, List[str]]
Example with ['Tooltip text line 1', 'Tooltip text line 2']
:
content
The UI element for which the tooltip will be displayed.
type: Widget
color_theme
Color theme of Tooltip widget.
type: Literal["dark", "light"]
default value: "dark"
placement
Place around the element where tooltip will be displayed. Must be one of "top"
,"top-start"
,"top-end"
,"bottom"
,"bottom-start"
,"bottom-end"
,"left"
,"left-start"
,"left-end"
,"right"
,"right-start"
,"right-end"
values.
type: Literal["top","top-start", ...]
default value: "bottom"
offset
Offset of the Tooltip in pixels.
type: int
default value: 0
transition
Describes the disappearance animation for widget. Must be one of "el-fade-in-linear"
, "el-fade-in"
values.
type: Literal["el-fade-in-linear","el-fade-in"]
default value: "el-fade-in-linear"
visible_arrow
Determines whether the tooltip should have an arrow pointing to the item or not.
type: bool
default value: True
Example with False
:
open_delay
Display delay in milliseconds.
type: int
default value: 0
Example with 2000
value:
enterable
Determines whether the cursor can enter the tooltip area or not.
type: bool
default value: True
hide_after
Hide delay in milliseconds. With the default value, it will not be hidden as long as the mouse is inside the UI element.
type: int
default value: 0
Example with 2000
value:
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
Mini App Example
You can find this example in our GitHub repository:
supervisely-ecosystem/ui-widgets-demos/text elements/006_tooltip/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Create widgets, that will be shown on app initialization.
Main widget for application Button
, and interactive widget Tooltip
that will display additional information for the main widget.
Create app layout
Prepare a layout for app using Card
widget with the content
parameter and place widget that we've just created in the Container
widget.
Create app using layout
Create an app object with layout parameter.
Last updated