save range date variable #332
-
Hi! I'm new with nicegui and I'd like to port my code and use it. I'm having problems to save the range of dates when they are selected. I would like to save "from" date, to "x" variable, and "to" date, to "y" variable for exemple. Sorry if it is a silly question... Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Your question might be related to #268 or #299 where we've also been asked about storing information from events into variables or other global state. If this is not what you've been looking for, you might want to provide a bit more context: What have you tried already and what exactly does not work? |
Beta Was this translation helpful? Give feedback.
-
How about this: x = None
y = None
def handle_date_range(event) -> None:
global x, y
x = event.value['from']
y = event.value['to']
print(x, y, flush=True)
ui.date(on_change=handle_date_range).props('range') |
Beta Was this translation helpful? Give feedback.
How about this: