CheckboxField
CheckboxField is similar to a Checkbox widget, but it is used in a form field. It allows to specify a title and a description for the checkbox.
Read this tutorial in developer portal.
Function signature
CheckboxField(
title="Title",
description="Description",
checked=False,
widget_id=None,
)Parameters
title
str
Checkbox title
description
str
Checkbox description
checked
Optional[bool]
Return True if checkbox is checked
widget_id
Optional[str]
ID of the widget
title
Checkbox title.
type: str
description
Checkbox description.
type: str
checked
Whether Checkbox is checked.
type: bool
default value: False
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
is_checked()
Return True if checked, else False.
set()
Set title, description, and checked properties.
check()
Enable checked property.
uncheck()
Disable checked property.
@value_changed
Decorator function is handled when checkbox value is changed.
is_checked()
Return True if checked, else False.
set()
Set title, description, and checked properties.
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/010_checkbox_field/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Initialize CheckboxField widget
CheckboxField widgetCreate app layout
Prepare a layout for the app using Card widget with the content parameter and place widget that we've just created in the Container widget.
Create the app using a layout
Create an app object with a layout parameter.
Add function to control widget from code
Last updated
Was this helpful?