jupyter-widgets / ipywidgets

Interactive Widgets for the Jupyter Notebook

Home Page:https://ipywidgets.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to update all widgets at once without so that update function is not called for each change

vpicouet opened this issue · comments

Hello,
Thanks a lot for the great project,
I implemented a simple astrophysical ETC here: https://fireball2-etc-2022.herokuapp.com (Code is here)

which allows, for a given space project, to change a bunch of parameters and see how it impacts the performance.
This works well.

test mov

There is also the possibility to change the instrument, but then it needs to change all the parameters (widgets.value).
Unfortunately, each time a widget value changes, it calls the update function which takes a lot of time (because of the 20 parameters)

Is it possible to prevent this from happening?
I was thinking there might already be a way to:

  • change all the widgets at once without calling the update function
  • Call the update function afterward

I implemented a small hack that account for a hidden widget value to know when to run the update function or not.