CheckBox
Create a checkbox the user can check and uncheck.
Creating a CheckBox
You can create a CheckBox using the following functions:
CheckBox()
CheckBox(text, action, color)
| Parameter | Type | Default | Description |
|---|---|---|---|
text |
str |
'' |
The text shown beside the checkbox. |
action |
function |
None |
The function to call when the checkbox changes; it receives one parameter, True if it was just checked or False if it was just unchecked. |
color |
Color |
Color.CLEAR |
The checkbox color. |
rotation |
int or float |
0 |
How far to turn the checkbox, in degrees, counter-clockwise. |
visibility |
int |
100 |
How visible the checkbox is, from 0 (invisible) to 100 (fully visible). |
For example,
checkbox = Checkbox("Check Me Out!")
Once created, you can add it to a Display using the Display's add() function.
Functions
Once a CheckBox has been created, the following functions are available:
| Function | Description |
|---|---|
getText() |
Return the checkbox's text. |
setText(text) |
Set the checkbox's text. |
getColor() |
Return the checkbox's color. |
setColor(color) |
Set the checkbox's color. |
check() |
Check the checkbox. |
uncheck() |
Uncheck the checkbox. |
isChecked() |
Report whether the checkbox is checked. |
Additionally, the following common functions are available: