Skip to content

scenario_selector class

Select scenarios from the list of all scenario entities.

Methods

__init__()

__init__(
    value=None,
    scenarios=None,
    multiple=False,
    filter="*",
    show_search=True,
    sort="*",
    show_add_button=True,
    display_cycles=True,
    show_primary_flag=True,
    show_pins=False,
    on_change=None,
    show_dialog=True,
    on_creation=None,
    height="50vh",
    id=None,
    class_name=None,
) -> None

Create a new scenario_selector element.

Parameters:

Name Type Description Default
value dynamic(Union[Scenario, list[Scenario]])

Bound to the selected Scenario, or None if there is none.

None
scenarios dynamic(list[Union[Scenario, Cycle]])

The list of Cycle or Scenario objects to show.
If this is None, all Cycles and Scenarios are listed.

None
multiple bool

If True, the user can select multiple scenarios, therefore the value property can hold a list of Scenario objects.

False
filter Union[bool, str, ScenarioFilter, list[Union[str, ScenarioFilter]]]

One or multiple Scenario property names to filter on.
If False, do not allow filter.

*
show_search bool

If False, prevents users from searching for scenarios by label.

True
sort Union[bool, str, ScenarioFilter, list[Union[str, ScenarioFilter]]]

A list of Scenario property names to sort on.
If False, do not allow sort.

*
show_add_button bool

If False, the button to create a new scenario is not displayed.

True
display_cycles bool

If False, the cycles are not shown.

True
show_primary_flag bool

If False, the primary scenarios are not identified with specific visual hint.

True
show_pins bool

If True, a pin is shown on each item of the selector and allows to restrict the number of displayed items.

False
on_change Union[str, Callable]

A function or the name of a function that is triggered when the value is updated.
The parameters of that function are all optional:

  • state (State): the state instance.
  • var_name (str): the variable name.
  • value (Scenario): the selected scenario.
None
show_dialog bool

If True, a dialog is shown when the user click on the 'Add scenario' button.

True
on_creation Union[str, Callable]

A function or the name of a function that is triggered when a scenario is about to be created.

All the parameters of that function are optional:

  • state (State): the state instance.
  • id (str): the identifier of this scenario selector.
  • payload (dict): the details on this callback's invocation.
    This dictionary has the following keys:
    • config (str): the name of the selected scenario configuration.
    • date (datetime): the creation date for the new scenario.
    • label (str): the user-specified label.
    • properties (dict): a dictionary containing all the user-defined custom properties.
  • The callback function can return a scenario, a string containing an error message (a scenario will not be created), or None (then a new scenario is created with the user parameters).
None
height str

The maximum height, in CSS units, of the control.

50vh
id str

The identifier that will be assigned to the rendered HTML component.

None
class_name dynamic(str)

The list of CSS class names associated with the generated HTML Element.
These class names will be added to the default taipy_gui_core-[element_type].

None