Skip to content
Discussion options

You must be logged in to vote

Yes, we're still debating about #1931.

Right now you can query elements by iterating something like the client's content element:

from nicegui import context, ui

with ui.button().props('itemName=Quiz_1_A'):
    ui.label('old label string').props('data-my-target')

button = [element for element in context.get_client().content if element._props.get('itemName') == 'Quiz_1_A'][0]
button.default_slot.children[0].text = 'new label string'

Or it you don't need the nested label:

from nicegui import context, ui

ui.button('old label').props('itemName=Quiz_1_A')

button = [element for element in context.get_client().content if element._props.get('itemName') == 'Quiz_1_A'][0]
button.text = 'new label'

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by retsyo
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