IFrame
Introduction
IFrame
widget in Supervisely allows to render .html
template in the app GUI. This widget is useful for displaying custom html content within an app.
Function signature
Parameters
path_to_html
str
Path to .html file inside static dir, must not include forward "/"
height
Union[str, int]
Height of the widget in px
width
Union[str, int]
Width of the widget in px
widget_id
str
ID of the widget
path_to_html
Path to .html file inside static dir, must not include forward "/"
type: str
Here is an example of template.html
file used on the screenshot below:
height
Height of the widget in px.
type: str
default value: None
width
Width of the widget in px.
type: str
default value: None
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
set()
Set html template to widget.
set_plot_size(value: str)
Set widget height and width in px.
clean_up()
Clean html template.
Mini App Example
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/layouts-and-containers/017_iframe/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Set path to static
directory
static
directoryInitialize Input
widget
Input
widgetCreate buttons to switch between html templates in IFrame
widget
IFrame
widgetCreate app layout
Create app using layout
Create an app object with layout parameter.
Add functions to switch html templates in IFrame
widget from python code
IFrame
widget from python codeLast updated