##// END OF EJS Templates
Add documentation for interactive function.
Torsten Bittner -
Show More
@@ -160,7 +160,23 b' def _widgets_from_abbreviations(seq):'
160 return result
160 return result
161
161
162 def interactive(__interact_f, **kwargs):
162 def interactive(__interact_f, **kwargs):
163 """Build a group of widgets to interact with a function."""
163 """
164 Builds a group of interactive widgets tied to a function and places the
165 group into a Box container.
166
167 Returns
168 -------
169 container : a Box instance containing multiple widgets
170
171 Parameters
172 ----------
173 __interact_f : function
174 The function to which the interactive widgets are tied. The **kwargs
175 should match the function signature.
176 **kwargs : various, optional
177 An interactive widget is created for each keyword argument that is a
178 valid widget abbreviation.
179 """
164 f = __interact_f
180 f = __interact_f
165 co = kwargs.pop('clear_output', True)
181 co = kwargs.pop('clear_output', True)
166 manual = kwargs.pop('__manual', False)
182 manual = kwargs.pop('__manual', False)
@@ -215,7 +231,7 b' def interactive(__interact_f, **kwargs):'
215 # Wire up the widgets
231 # Wire up the widgets
216 # If we are doing manual running, the callback is only triggered by the button
232 # If we are doing manual running, the callback is only triggered by the button
217 # Otherwise, it is triggered for every trait change received
233 # Otherwise, it is triggered for every trait change received
218 # On-demand running also suppresses running the fucntion with the initial parameters
234 # On-demand running also suppresses running the function with the initial parameters
219 if manual:
235 if manual:
220 manual_button.on_click(call_f)
236 manual_button.on_click(call_f)
221 else:
237 else:
@@ -230,12 +246,12 b' def interact(__interact_f=None, **kwargs):'
230 """
246 """
231 Displays interactive widgets which are tied to a function.
247 Displays interactive widgets which are tied to a function.
232 Expects the first argument to be a function. Parameters to this function are
248 Expects the first argument to be a function. Parameters to this function are
233 passed in as keyword arguments (**kwargs). Can be used as a decorator (see
249 widget abbreviations passed in as keyword arguments (**kwargs). Can be used
234 examples).
250 as a decorator (see examples).
235
251
236 Returns
252 Returns
237 -------
253 -------
238 __interact_f with interactive widget attached to it.
254 f : __interact_f with interactive widget attached to it.
239
255
240 Parameters
256 Parameters
241 ----------
257 ----------
@@ -243,8 +259,8 b' def interact(__interact_f=None, **kwargs):'
243 The function to which the interactive widgets are tied. The **kwargs
259 The function to which the interactive widgets are tied. The **kwargs
244 should match the function signature. Passed to :func:`interactive()`
260 should match the function signature. Passed to :func:`interactive()`
245 **kwargs : various, optional
261 **kwargs : various, optional
246 An interactive widget will be created for each keyword argument. Passed
262 An interactive widget is created for each keyword argument that is a
247 to :func:`interactive()`
263 valid widget abbreviation. Passed to :func:`interactive()`
248
264
249 Examples
265 Examples
250 --------
266 --------
General Comments 0
You need to be logged in to leave comments. Login now