In addition to "on" and "off", check buttons can be an
"in between" state that is neither on nor off. This can be used
e.g. when the user has selected a range of elements (such as some
text or spreadsheet cells) that are affected by a check button,
and the current values in that range are inconsistent.
Check buttons can be grouped together, to form mutually exclusive
groups - only one of the buttons can be toggled at a time, and toggling
another one will switch the currently toggled one off.
Grouped check buttons use a different indicator, and are commonly referred
to as *radio buttons*.
When the code must keep track of the state of a group of radio buttons, it
is recommended to keep track of such state through a stateful
gio.action.Action with a target for each button. Using the toggled signals to keep
track of the group changes and state is discouraged.
A gtk.check_button.CheckButton places a label next to an indicator.
A gtk.check_button.CheckButton is created by calling either gtk.check_button.CheckButton.new_ or gtk.check_button.CheckButton.newWithLabel.
The state of a gtk.check_button.CheckButton can be set specifically using gtk.check_button.CheckButton.setActive, and retrieved using gtk.check_button.CheckButton.getActive.
Inconsistent state
In addition to "on" and "off", check buttons can be an "in between" state that is neither on nor off. This can be used e.g. when the user has selected a range of elements (such as some text or spreadsheet cells) that are affected by a check button, and the current values in that range are inconsistent.
To set a gtk.check_button.CheckButton to inconsistent state, use gtk.check_button.CheckButton.setInconsistent.
Grouping
Check buttons can be grouped together, to form mutually exclusive groups - only one of the buttons can be toggled at a time, and toggling another one will switch the currently toggled one off.
Grouped check buttons use a different indicator, and are commonly referred to as *radio buttons*.
To add a gtk.check_button.CheckButton to a group, use gtk.check_button.CheckButton.setGroup.
When the code must keep track of the state of a group of radio buttons, it is recommended to keep track of such state through a stateful gio.action.Action with a target for each button. Using the toggled signals to keep track of the group changes and state is discouraged.
CSS nodes
A gtk.check_button.CheckButton has a main node with name checkbutton. If the gtk.check_button.CheckButton.utf8 or gtk.check_button.CheckButton.Widget properties are set, it contains a child widget. The indicator node is named check when no group is set, and radio if the checkbutton is grouped together with other checkbuttons.
Accessibility
gtk.check_button.CheckButton uses the gtk.types.AccessibleRole.Checkbox role.