Container
Introduction
Container widget in Supervisely is a flexible tool that allows for organizing other widgets within it. It can be used to group related widgets, change the layout of widgets, and adjust the sizing of widgets. Container widget supports both horizontal and vertical layout options.
However, Container widget does not have any specific functionality on its own but serves as a wrapper for other widgets.
Function signature
container = Container(
widgets=[],
direction="vertical",
gap=10,
fractions=None,
widget_id=None
)Parameters
widgets
List[Widget]
List of widgets
direction
Literal["vertical", "horizontal"]
Container direction (vertical or horizontal)
gap
int
Gap between widgets in container
fractions
List[int]
Fractions for container splitting
widget_id
str
Widget ID
widgets
List of widgets
type: List[Widget]
default []

direction
Container direction (vertical or horizontal)
type: Literal["vertical", "horizontal"]
default "vertical"

gap
Gap between widgets in container
type: int
default 10

fractions
Fractions for container splitting. direction parameter have to be horizontal
type: List[int]
default None

Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/layouts and containers/002_container/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Prepare widgets for Container widget
Container widgetInitialize Container widget
Container widgetCreate app layout
Prepare a layout for app using Card widget with the content parameter.
Create app using layout
Create an app object with layout parameter.

Last updated
Was this helpful?