Checkbox#

squap.add_checkbox(
name,
init_value=False,
var_name=None,
print_value=False,
row=None,
)[source]#

Adds a checkbox to the main input widget, or to all input tables if there are more.

Parameters:
  • name (str) – The name in front of the checkbox.

  • init_value (bool) – The initial value of the checkbox. Defaults to False (not ticked).

  • var_name (str, optional) – The name of the created variable. If var_name is not provided, the variable will be named name.

  • print_value (bool) – Whether to print the value of the checkbox when it changes. Defaults to False.

  • row (int, optional) – Row to which the checkbox is added. Defaults to first empty row.

Returns:

The created checkbox widget(s).

Return type:

CheckBox or list of CheckBox

class squap.widgets.InputTable.CheckBox#
CheckBox.bind(func)#

Bind function func to this box, meaning that when the value of the box is changed, the function is called.

Parameters:

func (callable) – function to bind to this box.

CheckBox.unbind(func)#

Unbind function. Is used internally when removing a box.

Parameters:

func (callable) – function to unbind from this box.

CheckBox.set_value(value)#

Set the value of the box and var.var_name to value. Note that for a slider, the new slider position will be the closest possible position to value, and the new value of var.var_name will be the value corresponding to the new slider position.

CheckBox.value()#

Return the current value of var.var_name

CheckBox.change_params(**kwargs)#

Changes the parameters of the checkbox. Only keyword arguments are accepted, and takes all arguments that squap.add_checkbox() accepts, except init_value and row.

CheckBox.print_val()#

Print the current value of the box. Used for the print_value keyword argument.

CheckBox.remove()#

Remove this box.