Checkbox

Checkbox allows to select one or more items from a group, or switch between two mutually exclusive options (checked or unchecked, on or off).

Properties#

NameTypeDefaultDescription
valueboolfalseCurrent value of the checkbox.
labelstringLabel to display next to the checkbox.
boxSidestringstartAllows you to set the checkbox to be at the before (start) or after (end) the label.
datastringAdditional data attached to the control. The value is passed in change event data along with a checkbox state.

Events#

NameDescription
changeFires when the state of checkbox is changed.

Examples#

Adding a new checkbox:

chk_agree = page.add(Checkbox(label="I agree to the terms of services"))

To verify if the checkbox is checked:

checked = page.get_value(chk_agree)
if checked == 'true':
print("Yes, checked!")