Skip to content

Instantly share code, notes, and snippets.

@pplonski
Created June 9, 2023 08:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pplonski/4f47dbac6068729449e89a470beef862 to your computer and use it in GitHub Desktop.
Save pplonski/4f47dbac6068729449e89a470beef862 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gmouawad
Copy link

gmouawad commented Jun 9, 2023

hello, if I may add an issue faced, if selected_letter has multiple items, directly, item1 is selected. and if I selected Item2, it refreshed and the print(f"Selected letter: {selected_letter.value}") returns "Selected letter: none". is that normal behavior? can we keep the items in the select object until Run API button is clicked again?

@pplonski
Copy link
Author

pplonski commented Jun 9, 2023

Sure we can. You can add varoable to keep selected values and only change it when button clicked.

@gmouawad
Copy link

gmouawad commented Jun 9, 2023

Sure we can. You can add varoable to keep selected values and only change it when button clicked.

can you let me know how? I tried applying a variable assignment but it didn't do the job

@pplonski
Copy link
Author

pplonski commented Jun 9, 2023

Please just move the cell with my_letters = [] to the top.

Cells are automatically re-executed after widget update. But we don't re-execute all cells, only cells below updated widget.

Screenshot 2023-06-09 at 14 59 48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment