Show More
@@ -23,7 +23,7 b' from inspect import getcallargs' | |||
|
23 | 23 | from IPython.core.getipython import get_ipython |
|
24 | 24 | from IPython.html.widgets import (Widget, TextWidget, |
|
25 | 25 | FloatSliderWidget, IntSliderWidget, CheckboxWidget, DropdownWidget, |
|
26 | ContainerWidget, DOMWidget, IntRangeSliderWidget) | |
|
26 | ContainerWidget, DOMWidget, IntRangeSliderWidget, FloatRangeSliderWidget) | |
|
27 | 27 | from IPython.display import display, clear_output |
|
28 | 28 | from IPython.utils.py3compat import string_types, unicode_type |
|
29 | 29 | from IPython.utils.traitlets import HasTraits, Any, Unicode |
@@ -116,6 +116,17 b' def _widget_abbrev(o):' | |||
|
116 | 116 | else: |
|
117 | 117 | cls = FloatRangeSliderWidget |
|
118 | 118 | return cls(value=(low, high), min=min, max=max) |
|
119 | elif _matches(o, [float_or_int]*5): | |
|
120 | min, low, high, max, step = o | |
|
121 | if not min <= low <= high <= max: | |
|
122 | raise ValueError("Range input expects min <= low <= high <= max, got %r" % o) | |
|
123 | if step <= 0: | |
|
124 | raise ValueError("step must be >= 0, not %r" % step) | |
|
125 | if all(isinstance(_, int) for _ in o): | |
|
126 | cls = IntRangeSliderWidget | |
|
127 | else: | |
|
128 | cls = FloatRangeSliderWidget | |
|
129 | return cls(value=(low, high), min=min, max=max, step=step) | |
|
119 | 130 | else: |
|
120 | 131 | return _widget_abbrev_single_value(o) |
|
121 | 132 |
General Comments 0
You need to be logged in to leave comments.
Login now