RadioTabs is a graphical user interface tool in Supervisely that allows users to group related widgets into tabs and switch between them using radio buttons. This feature is particularly useful for organizing and presenting complex interfaces with multiple settings and options. RadioTabs offers a simple and intuitive interface for users to quickly navigate between different tabs and access the desired widgets.
import os
import supervisely as sly
from dotenv import load_dotenv
from supervisely.app.widgets import Card, Container, RadioTabs, Text
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
load_dotenv("local.env")
load_dotenv(os.path.expanduser("~/supervisely.env"))
api = sly.Api()
Initialize RadioTabs widgets
tabs = RadioTabs(
titles=["Info tab", "Success tab", "Warning tab", "Error tab"],
contents=[
Text("Info text", status="info"),
Text("Success text", status="success"),
Text("Warning text", status="warning"),
Text("Error text", status="error"),
],
descriptions=[
"Tab with info text",
"Tab with success text",
"Tab with warning text",
"Tab with error text",
],
)
many_tabs = RadioTabs(
titles=[f"{i + 1} tab" for i in range(10)],
contents=[Text(f"{i + 1} text", status="info") for i in range(10)],
descriptions=[f"Tab with {i + 1} text" for i in range(10)],
)
Initialize Text widget to change text on widget
text = Text("Opened tab: Info tab")
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.