[IPython-dev] Link widget

Sylvain Corlay sylvain.corlay at gmail.com
Thu Mar 13 00:11:43 EDT 2014


Hi Jason,
I think this is great. Exactly what we needed for certain performance
issues we encountered.
Best,
Sylvain


On Wed, Mar 12, 2014 at 10:46 PM, Jason Grout
<jason-sage at creativetrax.com>wrote:

> Hi all,
>
> I was working on the next level of optimizations for linking widgets
> together, and came up with a Link widget that links widget values
> together on the javascript side, to avoid a roundtrip to python.  Demo
> here:
>
> http://sagecell.sagemath.org/?q=bhlnao [1]
>
> Notice that the first two sliders are lockstep with each other (they are
> linked with the Link widget), but the third slider has a delay because
> it necessitates a roundtrip to python.
>
> Code is in my ipywidgets repository at
> https://github.com/jasongrout/ipywidgets
>
> The Link widget still has some things to fix (like unregistering if it
> is destroyed or explicitly unbound, testing to make sure changing the
> list of bindings has the right effect, etc.), but do you think it is
> valuable enough of an idea to include in the standard widget set?
>
> Thanks,
>
> Jason
>
>
> [1] Code at the link is:
>
> html("<script
> src='https://rawgithub.com/jasongrout/ipywidgets/master/widgets.js
> '></script>")
> load('https://rawgithub.com/jasongrout/ipywidgets/master/widgets.py')
>
> from IPython.html import widgets
> a = widgets.FloatSliderWidget(value=30)
> b = widgets.FloatSliderWidget()
> c = widgets.FloatSliderWidget()
> show(a)
> show(b)
> show(c)
> javascript_link=Link(widgets=[[a,'value'], [b,'value']])
> show(javascript_link)
>
> from IPython.utils.traitlets import link
> python_link = link([a,'value'], [c, 'value'])
>
> print "Notice the delay in the third slider from the roundtrip to python."
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20140313/d4a10ffd/attachment.html>


More information about the IPython-dev mailing list