Slider#
- squap.add_slider(
- name,
- init_value=1.0,
- min_value=0.0,
- max_value=10.0,
- n_ticks=51,
- tick_interval=None,
- only_ints=False,
- logscale=False,
- custom_arr=None,
- var_name=None,
- print_value=False,
- row=None,
Adds a
sliderto the main input widget, or to allinput tablesif there are more.- Parameters:
name (str) – The name in front of the slider.
init_value (float) – The initial value of the slider. If the provided value is not on the slider, it gets set to the closest value.
min_value (float) – The minimum value of the slider.
max_value (float) – The maximum value of the slider.
n_ticks (int) – The number of ticks on the slider. Defaults to
51.tick_interval (float, optional) – The interval between ticks. If provided, overwrites
n_ticks.only_ints (bool) – Whether to use whole numbers as ticks. If set to
True,tick_intervalis used as spacing between the ticks andn_ticksis ignored. Iftick_intervalis not specified, it defaults to1. Roundstick_intervalto an integer and changes the variable to always be an integer. Not allowed in combination withlogscale. Defaults toFalse.logscale (bool) – Whether to use a logarithmic scale. When
tick_intervalis given it serves as a multiplication factor between a point and the previous point (it is rounded to fitmin_valueandmax_value. Not allowed in combination withonly_ints. Defaults toFalse.custom_arr (iterable, optional) – Array or list of values, where
custom_arr[i]will be the value (can be any type) of the slider when it is set to positioni. Overwrites all other parameters (exceptinit_value). Defaults toNone.var_name (str, optional) – The name of the created variable. If
var_nameis not provided, the variable will be namedname.print_value (bool) – Whether to print the value of the slider when it changes. Defaults to
False.row (int, optional) – Row to which the slider is added. Defaults to first empty row.
- Returns:
The created
slider widget(s).- Return type:
- class squap.widgets.InputTable.Slider#
- Slider.bind(func)#
Bind function
functo 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.
- Slider.unbind(func)#
Unbind function. Is used internally when removing a box.
- Parameters:
func (callable) – function to unbind from this box.
- Slider.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 tovalue, and the new value of var.var_name will be the value corresponding to the new slider position.
- Slider.value()#
Return the current value of var.var_name
- Slider.set_index(index)#
Sets the index to
index.
- Slider.index()#
Returns the current index.
- Slider.change_params(**kwargs)#
Changes the parameters of the slider. Only keyword arguments are accepted, and takes all arguments that
squap.add_slider()accepts, exceptinit_valueandrow.
- Slider.print_val()#
Print the current value of the box. Used for the
print_valuekeyword argument.
- Slider.remove()#
Remove this box.