Capture value of Dropdown Selection everytime it changes #538
-
Hi how do I capture the value of the item selected in the Dropdown Selection so that the capturing variable is updated each time the selection changes? Expected: Actual result: from nicegui import ui
def set_allow_moving(val):
return val.value
select1 = ui.select([1, 2, 3], value=1, on_change=set_allow_moving)
print(set_allow_moving(select1))
ui.run() |
Beta Was this translation helpful? Give feedback.
Answered by
falkoschindler
Mar 16, 2023
Replies: 1 comment 2 replies
-
If you want to print the value whenever it changes, you should do it in the change event handler: def set_allow_moving(event):
print(event.value)
ui.select([1, 2, 3], value=1, on_change=set_allow_moving) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
falkoschindler
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to print the value whenever it changes, you should do it in the change event handler: