Skip to content
Discussion options

You must be logged in to vote
dict_state = {
    'ele_a':False,
    'ele_b':False,
}
@ui.refreshable
def buttons():
    with ui.dropdown_button('choose element visible'):
        ui.item(['\u3000','\u2714\u0020'][dict_state['ele_a']]+'element a',on_click=lambda :(dict_state.update(ele_a=not dict_state['ele_a']),buttons.refresh()))
        ui.item(['\u3000','\u2714\u0020'][dict_state['ele_b']]+'element b',on_click=lambda :(dict_state.update(ele_b=not dict_state['ele_b']),buttons.refresh()))
buttons()
with ui.dropdown_button('choose element visible'):
    with ui.item():
        ui.switch('element a',on_change=buttons.refresh).bind_value(dict_state,'ele_a')
    with ui.item():
        ui.switch('element b',on_change=but…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Kowersky
Comment options

@python-and-novella
Comment options

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