Skip to content
Advertisement

Ipywidgets observe method on interactive instead of widget

Both ipython widgets and interactive objects have observe() methods. (See the results of the print statements.) With the following example, I can confirm the actions of the observe() method on a slider widget but not on the interactive (ie) object.

Q: Is there any way to use the interactive’s observe method or I have to call separate observe() method on it’s all widget components ? If so, why ?

Expected behavior: Printing ‘ie change observed’ after changing inp1,

JavaScript

I’m a newbie, any help on the correct usage would be appreciated.

Advertisement

Answer

Yeah, no you can’t do that. The interactive object’s observe will be for changes in children. So, no change there.

What you could do instead is put an observe on the children. Like this.

JavaScript

so, your code will look something like this:

JavaScript
Advertisement