Skip to content

Running function from lambda, but adding non-child element #3823

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

You must be logged in to vote

hi,
If you just want to hide/show objects, you may want to have a look at method set_visibility or bind_visibility

from nicegui import ui


# Example 1: Binding visibility to a dictionary (object is hidden by default as the initial value is False)
# --------------------------------------------------------------------------------------------

# Dictionnary  used to hold the value
ls_state = dict(row_visibility = False)

with ui.grid():
    data = ui.button(text = "Text example 1",
                     on_click = lambda: show_hide_element_example1(data)
                     )

with ui.row().bind_visibility(target_object = ls_state, target_name = 'row_visibility'):
    ui.input(label = "Add …

Replies: 2 comments 4 replies

Comment options

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

Answer selected by Normanras
Comment options

You must be logged in to vote
3 replies
@Normanras
Comment options

@python-and-fiction
Comment options

@Normanras
Comment options

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