NREL / PVcircuit

optoelectronic models for tandem/multijunction solar cells
BSD 3-Clause "New" or "Revised" License
15 stars 4 forks source link

jupyter widgets seem to be one-way. What if an attribute is changed elsewhere? Can it be dynamically change in the widget? #3

Open jgeisz opened 2 years ago

jbuencuerpo commented 2 years ago

So basically you are saying, update the value in other part of the code, and then update the ui right? I think it can be done by accesing the .value of the widget[1]. But I am not sure what you are trying, do you have a simple code to look at?

[1] https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Low%20Level.html

jgeisz commented 2 years ago

dynamic widget update can be problem because of recursion.

jgeisz commented 2 years ago

yes, change the widget.value in the .update() methods. This is a good enough solution. The user just needs to know and remember to use it when changing the values outside of the ui.