Example #1
0
def construct_ui(ui: Declarative.DeclarativeUI):
    shape_choice = ui.create_combo_box(
        items=["Rectangle", "Circle", "Interval"],
        current_index="@binding(shape_index_model.value)")
    shape_component = ui.create_component_instance(
        "@binding(shape_page.value)")
    return ui.create_column(shape_choice,
                            shape_component,
                            spacing=8,
                            margin=12)
Example #2
0
def construct_ui(u: Declarative.DeclarativeUI) -> Declarative.UIDescription:
    field_width = u.create_component_instance("field", {"label": "Width", "value": "20"}, name="width_field", on_value_changed="width_changed")
    field_height = u.create_component_instance("field", {"label": "Height", "value": "30"}, name="height_field", on_value_changed="height_changed")
    reset_button = u.create_push_button(text="Reset", on_clicked="reset")
    return u.create_column(field_width, field_height, reset_button, spacing=8)