Skip to content

scenario

Displays and modify the definition of a scenario.

Properties

Name Type Default Description
scenario(★) Scenario|list[Scenario]
dynamic

The scenario to display and edit.
If the value is a list, it must have a single element otherwise nothing is shown.

active bool
dynamic
True

Indicates if this component is active.
An inactive component allows no user interaction.

expandable bool True

If True, the scenario viewer can be expanded.
If False, the scenario viewer is not expandable and it is shown depending on expanded value.

expanded bool True

If True, when a valid scenario is selected, the scenario viewer is expanded and its content is displayed.
If False, the scenario viewer is collapsed and only its name and submit button are visible.

show_submit bool True

If False, the scenario submit button is not visible.

show_delete bool True

If False, the button to delete a scenario is not visible.

show_config bool False

If False, the scenario configuration label is not visible.

show_creation_date bool False

If False, the scenario creation date is not visible.

show_cycle bool False

If False, the scenario cycle label is not visible.

show_tags bool True

If False, the scenario tags are not visible.

show_properties bool True

If False, the scenario properties are not visible.

show_sequences bool True

If False, the scenario sequences are not visible.

show_submit_sequences bool True

If False, the buttons to submit scenario sequences are not visible.

on_submission_change Callback

The name of the function that is triggered when a submission status is changed.

All the parameters of that function are optional:

  • state (State): the state instance.
  • submittable (Submittable): the entity (usually a Scenario) that was submitted.
  • details (dict): the details on this callback's invocation.
    This dictionary has the following keys:
    • submission_status (str): the new status of the submission (possible values: SUBMITTED, COMPLETED, CANCELED, FAILED, BLOCKED, WAITING, RUNNING).
    • job: the Job (if any) that is at the origin of the submission status change.

id str

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

class_name str
dynamic

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

(★)scenario is the default property for this visual element.

Details

The scenario control displays the information stored in a given scenario, lets the user change its parameters at runtime, and provides ways to submit it or one of its sequences.

When the scenario property is set to a Scenario instance, the control displays the information for that scenario.

Here is what the control would look like when representing a scenario entity:

Viewing the parameters of a scenario

Next to the scenario's label at the top of the control and if the scenario is primary in its cycle, there is an icon showing a flag.
On the right side of the label, a 'play' button can trigger the scenario submission.

The user can click the scenario label to change it:

Editing the scenario label

The user must click the 'check' button to apply the change or the 'cross' button to cancel the operation.

The user can see the scenario's tags in the 'Tags' section.
To add a tag, enter text in the tags area and press 'Enter'. You can create as many tags as you want. When you have created all the tags and want to add those tags to the scenario, press the 'Apply' button to the right of the tags area.
You can cancel your actions by pressing the 'Cancel' button.

The 'Sequences' section presents the potential sequences of the scenario.
To add a sequence, press the 'Add +' button. A new sequence is then created, for which you must provide a name (note each sequence must have a unique name).
To edit a sequence, click anywhere on its row. You can then rename it and select its tasks.
To delete a sequence, click the trash icon of its row.

If the scenario has sequences, the user can submit each sequence independently by pressing the 'Submit' button to the right of the sequence's label.

Users can also add or modify custom properties. Click on an existing property name or value to modify it, and the "New Property Key" label or "Value" next to it to create a new custom property.
Here is what the section looks like when the user requests the creation of a new property:

Editing custom properties

To delete a custom property, the user must select it, then press The 'trash' button that appears on the right side.

Usage

Show or hide sections

A few properties (namely show_submit, show_delete, show_config, show_cycle, show_tags, show_properties, show_sequences, and show_submit_sequences) let you customize what sections of the scenario control are visible.

Here is the definition of such a control where the tags, properties and sequences sections are hidden:

Definition

<|{scenario}|scenario|don't show_tags|don't show_properties|don't show_sequences|>
<taipy:scenario show_tags="false" show_properties="false" show_sequences="false">{scenario}</taipy:scenario>
import taipy.gui.builder as tgb
...
tgb.scenario("{scenario}", show_tags=False, show_properties=False, show_sequences=False)

The control appears as follows, in a more compact manner:

Hiding some sections