Show More
@@ -155,6 +155,7 b' def _widgets_from_abbreviations(seq):' | |||||
155 | widget = _widget_from_abbrev(abbrev, default) |
|
155 | widget = _widget_from_abbrev(abbrev, default) | |
156 | if not widget.description: |
|
156 | if not widget.description: | |
157 | widget.description = name |
|
157 | widget.description = name | |
|
158 | widget._kwarg = name | |||
158 | result.append(widget) |
|
159 | result.append(widget) | |
159 | return result |
|
160 | return result | |
160 |
|
161 | |||
@@ -194,7 +195,7 b' def interactive(__interact_f, **kwargs):' | |||||
194 | container.kwargs = {} |
|
195 | container.kwargs = {} | |
195 | for widget in kwargs_widgets: |
|
196 | for widget in kwargs_widgets: | |
196 | value = widget.value |
|
197 | value = widget.value | |
197 |
container.kwargs[widget. |
|
198 | container.kwargs[widget._kwarg] = value | |
198 | if co: |
|
199 | if co: | |
199 | clear_output(wait=True) |
|
200 | clear_output(wait=True) | |
200 | if manual: |
|
201 | if manual: |
@@ -489,13 +489,20 b' def test_default_description():' | |||||
489 | ) |
|
489 | ) | |
490 |
|
490 | |||
491 | def test_custom_description(): |
|
491 | def test_custom_description(): | |
492 | c = interactive(f, b=widgets.Text(value='text', description='foo')) |
|
492 | d = {} | |
|
493 | def record_kwargs(**kwargs): | |||
|
494 | d.clear() | |||
|
495 | d.update(kwargs) | |||
|
496 | ||||
|
497 | c = interactive(record_kwargs, b=widgets.Text(value='text', description='foo')) | |||
493 | w = c.children[0] |
|
498 | w = c.children[0] | |
494 | check_widget(w, |
|
499 | check_widget(w, | |
495 | cls=widgets.Text, |
|
500 | cls=widgets.Text, | |
496 | value='text', |
|
501 | value='text', | |
497 | description='foo', |
|
502 | description='foo', | |
498 | ) |
|
503 | ) | |
|
504 | w.value = 'different text' | |||
|
505 | nt.assert_equal(d, {'b': 'different text'}) | |||
499 |
|
506 | |||
500 | def test_interact_manual_button(): |
|
507 | def test_interact_manual_button(): | |
501 | c = interactive(f, __manual=True) |
|
508 | c = interactive(f, __manual=True) |
General Comments 0
You need to be logged in to leave comments.
Login now