[Python] The name of vuetify VListGroup in Trame

Discussão em 'Python' iniciado por Stack, Junho 5, 2025.

  1. Stack

    Stack Membro Participativo

    I'm making a menu with submenus in Python Trame. Here is a working example:

    from trame.app import get_server
    from trame.ui.vuetify import SinglePageWithDrawerLayout
    from trame.widgets import vuetify

    server = get_server(client_type="vue2")
    state, ctrl = server.state, server.controller

    state.menu_show = False
    state.menu_items = [
    {"title": "Load Light Guide", "icon": "mdi-cube", "value": "lg_load"},
    {"title": "Load Project", "icon": "mdi-database", "value": "pj_load"},
    {"title": "Save Project", "icon": "mdi-content-save", "value": "pj_save"},
    ]

    def menu_toggle():
    state.menu_show = not state.menu_show

    ctrl.menu_toggle = menu_toggle

    with SinglePageWithDrawerLayout(server, title="Ray Tracer") as layout:
    layout.icon.click = ctrl.menu_toggle
    layout.drawer.v_model = "menu_show"

    with layout.drawer:
    with vuetify.VList():
    with vuetify.VListGroup():
    with vuetify.Template(v_slot_activator="{ props }"):
    vuetify.VListItem(
    v_bind="props",
    title="File",
    )
    for item in state.menu_items:
    vuetify.VListItem(
    item["title"],
    prepend_icon=item["icon"],
    dense=True,
    )



    if __name__ == "__main__":
    server.start()



    But I want the supmenu name "File" to be exposed and it is not. The same is with icons.

    It seems that Trame doesn't have attribute title and the title of VListItem for instance should be passed as positional argument. But neither positional nor named argument doesn't work for VListGroup.

    Could anyone help?

    Continue reading...

Compartilhe esta Página