<div dir="ltr">Hi Jason, <div>I think this is great. Exactly what we needed for certain performance issues we encountered. </div><div>Best, </div><div>Sylvain</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Mar 12, 2014 at 10:46 PM, Jason Grout <span dir="ltr"><<a href="mailto:jason-sage@creativetrax.com" target="_blank">jason-sage@creativetrax.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
I was working on the next level of optimizations for linking widgets<br>
together, and came up with a Link widget that links widget values<br>
together on the javascript side, to avoid a roundtrip to python.  Demo here:<br>
<br>
<a href="http://sagecell.sagemath.org/?q=bhlnao" target="_blank">http://sagecell.sagemath.org/?q=bhlnao</a> [1]<br>
<br>
Notice that the first two sliders are lockstep with each other (they are<br>
linked with the Link widget), but the third slider has a delay because<br>
it necessitates a roundtrip to python.<br>
<br>
Code is in my ipywidgets repository at<br>
<a href="https://github.com/jasongrout/ipywidgets" target="_blank">https://github.com/jasongrout/ipywidgets</a><br>
<br>
The Link widget still has some things to fix (like unregistering if it<br>
is destroyed or explicitly unbound, testing to make sure changing the<br>
list of bindings has the right effect, etc.), but do you think it is<br>
valuable enough of an idea to include in the standard widget set?<br>
<br>
Thanks,<br>
<br>
Jason<br>
<br>
<br>
[1] Code at the link is:<br>
<br>
html("<script<br>
src='<a href="https://rawgithub.com/jasongrout/ipywidgets/master/widgets.js" target="_blank">https://rawgithub.com/jasongrout/ipywidgets/master/widgets.js</a>'></script>")<br>
load('<a href="https://rawgithub.com/jasongrout/ipywidgets/master/widgets.py" target="_blank">https://rawgithub.com/jasongrout/ipywidgets/master/widgets.py</a>')<br>
<br>
from IPython.html import widgets<br>
a = widgets.FloatSliderWidget(value=30)<br>
b = widgets.FloatSliderWidget()<br>
c = widgets.FloatSliderWidget()<br>
show(a)<br>
show(b)<br>
show(c)<br>
javascript_link=Link(widgets=[[a,'value'], [b,'value']])<br>
show(javascript_link)<br>
<br>
from IPython.utils.traitlets import link<br>
python_link = link([a,'value'], [c, 'value'])<br>
<br>
print "Notice the delay in the third slider from the roundtrip to python."<br>
_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org">IPython-dev@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/ipython-dev" target="_blank">http://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
</blockquote></div><br></div>