[IPython-dev] Altering interact controls at run-time

Jonathan Frederic jon.freder at gmail.com
Tue Apr 22 18:13:39 EDT 2014

Hi Scott,

There are a few of ways to do this.

The easiest is to create the widget instance yourself and pass it into
interact.  See input 4 of this notebook
a is assigned to a custom FloatSliderWidget.  You could do the same
thing, but construct the slider before the interact call.  This would give
you a handle to the slider that you could use in your function.

Another method is to use the version of interact that returns handles to
the widget instances.

Lastly, you can always create and manage the widgets yourself, without
interact.  See the other widget example notebooks for more information.


On Tue, Apr 22, 2014 at 1:52 PM, Scott Burns
<scott.s.burns at vanderbilt.edu>wrote:

> I published a little toy MR viewer <https://github.com/sburns/mrinteract>built on the new interact infrastructure. It's amazing how much work that
> little function is doing.
> One thing I couldn't figure was whether it's possible to alter the range
> of sliders based on the values of other controls? For example, a slider
> should go between 0 and 10 when a dropdown is 'a', but between 0-5 when the
> dropdown is set to 'b'.
> --Scott
> _______________________________________________
> 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/20140422/3cb42877/attachment.html>

More information about the IPython-dev mailing list