[IPython-dev] Link widget

Sylvain Corlay sylvain.corlay at gmail.com
Mon Apr 7 17:06:26 EDT 2014

I personally would prefer to exactly reproduce the signature of
IPython.utils.traitlets.link (using tuples rather than lists etc) even if
it is merely a wrapper around a the creation of the Link object.
Another reason is that you need to call display() on the link instance,
which is a bit misleading from the user's point of view.

On Thu, Mar 13, 2014 at 2:18 PM, Jason Grout <jason-sage at creativetrax.com>wrote:

> On 3/13/14, 12:59, Sylvain Corlay wrote:
> > Quick question on the API:
> >
> > Does it really have to be a widget, or could it be a function in
> > IPython.html.widgets.
> >
> > from IPython.html import widgets
> > a = widgets.FloatSliderWidget(value=30)
> > b = widgets.FloatSliderWidget()
> >
> > show(a)
> > show(b)
> >
> > widgets.link([[a,'value'], [b,'value']])    # could be called "sync" as
> well
> >
> Somehow, the message has to get across to the javascript side that the
> models should be linked together.  We could send a message to, say, the
> widget manager to do that, but right now we don't have a good way to
> directly communicate with the widget manager and send it messages.  I
> hesitate to add such a messaging system when it seems even better to
> have the link object be a separate object we can manipulate by itself.
> By making the link a separate object (mirroring the link function in the
> traitlets file), it's easy to change the properties of the link, or
> abolish the link altogether.  That said, we could make a link() function
> in the widgets.py file that would construct, display, and return the
> Link object.
> I chose the name link because that was what we decided to do in the
> traitlets case: https://github.com/ipython/ipython/pull/5060.
> Thanks,
> Jason
> _______________________________________________
> 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/20140407/d528bf45/attachment.html>

More information about the IPython-dev mailing list