Checkbox

Introduction

This widget is a simple and intuitive interface element that allows users to select given option. The Checkbox widget can be customized with different label text and default state. By providing an easy and efficient way to make selections, the Checkbox widget is an essential tool for any image or video annotation project.

Function signature

checkbox = Checkbox(
    content="Enable",
    checked=False,
    widget_id=None,
)

Parameters

Parameters
Type
Description

content

Union[Widget, str]

Checkbox content

checked

bool

Return True if checkbox is checked

widget_id

str

ID of the widget

content

Checkbox content.

type: Union[Widget, str]

checked

Whether Checkbox is checked. Return True if checked.

type: bool

default value: False

widget_id

ID of the widget.

type: str

default value: None

Methods and attributes

Attributes and Methods
Description

is_checked()

Return True if checked, else False.

check()

Enable checked property.

uncheck()

Disable checked property.

@value_changed

Decorator function is handled when checkbox value is changed.

Mini App Example

You can find this example in our Github repository:

ui-widgets-demos/controls/002_checkbox/src/main.py

Import libraries

Init API client

First, we load environment variables with credentials and init API for communicating with Supervisely Instance:

Initialize Project ID we will use

Initialize Checkbox widget

Create more widgets

In this tutorial we will use SelectDataset, Button, NotificationBox widgets to show how to control Checkbox widget from python code.

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.

Add functions to control widget from python code

Last updated

Was this helpful?