-
QuestionHi there, I am trying to update the name of a chat message after creation. I found a method by using from nicegui import ui
@ui.page('/')
def main():
with ui.column():
# This works fine
msg1 = ui.chat_message('Hello!', name='Smart Bot')
msg2 = ui.chat_message('Hello!', name='Smart Bot')
msg3 = ui.chat_message('Hello!', name='Smart Bot')
# This gets cut off
new_name = 'Smarter Bot'
msg2.props(f'name={new_name}')
# This changes nothing
with msg3 as m:
m.name = 'Smartest Bot'
m.update()
ui.run() |
Beta Was this translation helpful? Give feedback.
Answered by
rodja
Nov 11, 2024
Replies: 2 comments 1 reply
-
You need to quote the name: msg2.props(f'name="{new_name}"') |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
zilch42
-
Alternatively you can use msg2.props['name'] = new_name or msg2.props.update(name=new_name) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to quote the name: