Skip to content

How to bind the ui.tab_panel's value to the app.storage.general #4435

Closed Answered by weinibuliu
weinibuliu asked this question in Q&A
Discussion options

You must be logged in to vote

I'm sorry I didn't see your mention of #3592 earlier.I fix my code according to this discussion.

from nicegui import ui, app

STORAGE = app.storage.general

with ui.tabs().classes("w-full").props("no-caps") as tabs:
    adb = ui.tab("adb", "ADB")
    win32 = ui.tab("win32", "Win32")

with ui.tab_panels(tabs, value="adb").classes("w-full") as tab_panels: # use the tab name instead of tab as value
    tab_panels.bind_value_to(STORAGE, "device", forward=lambda x: x)


ui.run()

Now,it works well.Thanks for your answer.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@weinibuliu
Comment options

Answer selected by weinibuliu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants