Is it possible to link IPython widgets less naively? -


i'll start simple example of i'm trying do:

say, have 2 intslider-widgets. have 1 represent x , other x^2 (unidirectional link). maybe want first slider display sqrt(x^2), if play second slider (bidirectional link).

this would,very naively, translate in this:

l1 = traitlets.link((widg1, 'value'),(widg2, 5* 'value')) 

which of course doesn't, because second tuple argument supposed string, passing 'valuevaluevaluevaluevalue'.

anyway, possible , if yes, has been implemented?

link passes on same value. if want transform value, need callback:

def widg1_changed(name, new_value):     widg2.value = 5 * new_value  widg1.on_trait_change(widg1_changed, 'value') 

i don't know of way bidirectionally @ present.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -