Dropdown#
- squap.add_dropdown(
- name,
- options,
- init_index=0,
- option_names=None,
- var_name=None,
- print_value=False,
- row=None,
Adds a
dropdownto the main input widget, or to allinput tablesif there are more.- Parameters:
name (str) – The name in front of the dropwdown.
options (Iterable) – A
listof all options the created variable can be, whereoption_names[index]is the value given to the variable, if the dropwdown is set toindex.init_index (int) – The index that the dropwdown is initially set to.
option_names (list of str, optional) – A
listof all options shown in the dropwdown menu. Ifoption_namesis not provided it will be set tooptions.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 dropwdown when it changes. Defaults to
False.row (int, optional) – Row to which the dropwdown is added. Defaults to first empty row.
- Returns:
The created
dropwdown widget(s).- Return type:
- class squap.widgets.InputTable.Dropdown#
- Dropdown.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.
- Dropdown.unbind(func)#
Unbind function. Is used internally when removing a box.
- Parameters:
func (callable) – function to unbind from this box.
- Dropdown.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.
- Dropdown.value()#
Return the current value of var.var_name
- Dropdown.set_index(index)#
Sets the index to
index.
- Dropdown.index()#
Returns the current index.
- Dropdown.change_params(**kwargs)#
Changes the parameters of the dropdown. Only keyword arguments are accepted, and takes all arguments that
squap.add_dropdown()accepts, exceptinit_valueandrow.
- Dropdown.print_val()#
Print the current value of the box. Used for the
print_valuekeyword argument.
- Dropdown.remove()#
Remove this box.