Skip to content

Instantly share code, notes, and snippets.

@pplonski
Created June 9, 2023 08:23
Show Gist options
  • Select an option

  • Save pplonski/4f47dbac6068729449e89a470beef862 to your computer and use it in GitHub Desktop.

Select an option

Save pplonski/4f47dbac6068729449e89a470beef862 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gmouawad

gmouawad commented Jun 9, 2023

Copy link
Copy Markdown

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

pplonski commented Jun 9, 2023

Copy link
Copy Markdown
Author

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

@gmouawad

gmouawad commented Jun 9, 2023

Copy link
Copy Markdown

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

pplonski commented Jun 9, 2023

Copy link
Copy Markdown
Author

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