Color Picker#

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

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

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

  • init_value (ColorType) – The initial value of the color picker.

  • 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 color picker when it changes. Defaults to False.

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

Returns:

The created color_picker widget(s).

Return type:

ColorPicker or list of ColorPicker

class squap.widgets.InputTable.ColorPicker#
ColorPicker.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.

ColorPicker.unbind(func)#

Unbind function. Is used internally when removing a box.

Parameters:

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

ColorPicker.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.

ColorPicker.value()#

Return the current value of var.var_name

ColorPicker.change_params(**kwargs)#

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

ColorPicker.print_val()#

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

ColorPicker.remove()#

Remove this box.