msticpy.nbwidgets.select_subset module

Module for pre-defined widget layouts.

class msticpy.nbwidgets.select_subset.SelectSubset(source_items: Dict[str, str] | List[Any], default_selected: Dict[str, str] | List[Any] | None = None, display_filter: bool = True, auto_display: bool = True)

Bases: IPyDisplayMixin

Class to select a subset from an input list.

Create instance of SelectSubset widget.

Parameters:
  • source_items (Union[Dict[str, str], List[Any]]) – List of source items - either a dictionary(label, value), a simple list or a list of (label, value) tuples.

  • default_selected (Union[Dict[str, str], List[Any]]) – Populate the selected list with values - either a dictionary(label, value), a simple list or a list of (label, value) tuples.

  • display_filter (bool, optional) – Whether to display item filter (the default is True)

  • auto_display (bool, optional) – Whether to display on instantiation (the default is True)

display()

Display the interactive widgets.

property selected_items: List[Any]

Return a list of the selected items.

If the input list is a list of tuples, this returns a list of the selected tuples.

Returns:

List of items in the selected list.

Return type:

List[Any]

property selected_values: List[Any]

Return list of selected values.

If the input list is a list of tuples, this returns a list of values of the items.

Returns:

List of selected item values.

Return type:

List[Any]

property value: List[Any]

Return currently selected value or values.