API¶
- class scwidgets.CheckRegistry(**kwargs: Any)[source]¶
Manages the assignment of checks to widgets and the execution of checks. It allows to run the checks of all widgets and properly pipes the result to the corresponding function of the widget.
- property checks¶
all registerd checks from widgets to checks
- nb_conducted_asserts(widget: CheckableWidget)[source]¶
The total number of asserts that will be conducted for the widget
- Parameters:
widget – the checks of the widget are targeted
- class scwidgets.CodeExercise(**kwargs: Any)[source]¶
A widget to demonstrate code interactively in a variety of ways. It is a combination of the several widgets that allow to check check, run and visualize code.
- Parameters:
code – A function or CodeInput that is the input of code
check_registry – A check registry that is used to register checks
exercise_registry – A exercise registry that is used to register the answers to save them later. If specified the save and load panel will appear.
key – The key that is used to store the exercise in the json file.
parameters – Input parameters for the
ParametersPanelclass or an initializedParametersPanelobject. Specifies the arguments in the parameter panel.update_mode – Determines how the parameters are refreshed on changes of the code input or parameters
outputs – List of CueOuputs that are drawn and refreshed
update – A function that is run during the update process. The function takes as argument the CodeExercise, so it can update all cue_ouputs
description – A string describing the exercises that will be put into an HTML widget above the exercise.
title – A title for the exercise. If not given the key is used.
- property answer: dict¶
Translates the widget state into a string
- compute_output_to_check(*args, **kwargs) Tuple[Any, ...][source]¶
The widget returns the output that will verified by the added checks.
- handle_checks_result(results: List[CheckResult | Exception])[source]¶
Function that controls how results of the checks are handled.
- handle_load_result(result: str | Exception)[source]¶
Function that controls how a load result is handled. If the result is a string, the loading was successfull. The result contains a string that can be outputed.
- handle_save_result(result: str | Exception)[source]¶
Function that controls how a save result is handled. If the result is a string, the saving was successfull. The result contains a string that can be outputed.
- property panel_parameters: Dict[str, FunInParamT]¶
- Returns:
Only parameters that are tunable in the parameter panel are returned. Fixed parameters are ignored.
- property parameters: Dict[str, FunInParamT]¶
- Returns:
All parameters that were given on initialization are returned, also including also fixed parameters.
- property parameters_panel: ParametersPanel | None¶
- Returns:
The parametergs panel widget.
- class scwidgets.CodeInput(**kwargs: Any)[source]¶
Small wrapper around WidgetCodeInput that controls the output
- Parameters:
function – We can automatically parse the function. Note that during parsing the source code might be differently formatted and certain python functionalities are not formatted. If you notice undesired changes by the parsing, please directly specify the function as string using the other parameters.
function_name – The name of the function
function_paramaters – The parameters as continuous string as specified in the signature of the function. e.g for foo(x, y = 5) it should be “x, y = 5”
docstring – The docstring of the function
function_body – The function definition without indentation
builtins – A dict of variable name and value that is added to the globals __builtins__ and thus available on initialization
- compatible_with_signature(parameters: List[str]) str[source]¶
This function checks if the arguments are compatible with the function signature and returns a nonempty message if this is not the case explaining what the issue
- property function: LambdaType¶
Return the compiled function object wrapped by an try-catch block raising a CodeValidationError.
This can be assigned to a variable and then called, for instance:
func = widget.wrapped_function # This can raise a SyntaxError retval = func(parameters)
- Raises:
SyntaxError – if the function code has syntax errors (or if the function name is not a valid identifier)
- property unwrapped_function: LambdaType¶
Return the compiled function object.
This can be assigned to a variable and then called, for instance:
func = widget.wrapped_function # This can raise a SyntaxError retval = func(parameters)
- Raises:
SyntaxError – if the function code has syntax errors (or if the function name is not a valid identifier)
- class scwidgets.CueFigure(**kwargs: Any)[source]¶
A cued displayable ipywidget.Output for a matplotlib figure. Provides utilities to clear and draw the updated figure. For the matplotlib inline backend it closes the active figure to prevent any display outside of the container, that happens on the creation of the figure because pyplot does magic behind the curtain that is hard to suppress. For the matplot interactive widget backend, named “nbagg”, it wraps te figure within.
- Parameters:
figure – The matplotlib figure
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed.
traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits.
cued – Specifies if it is cued on initialization
show_toolbars – Hide toolbars and headers when using in widget mode.
css_syle –
base: the css style of the box during initialization
cue: the css style that is added when :param traits_to_observe: in widget :param widgets_to_observe: changes. It is supposed to change the style of the box such that the user has a visual cue that :param widget_to_cue: has changed.
- clear_display(wait=False)[source]¶
- Parameters:
wait – same meaning as for the wait parameter in the ipywidgets.clear_output function
- class scwidgets.CueObject(**kwargs: Any)[source]¶
A cued displayable ipywidget.Output for any Python object. Provides utilities to clear and redraw the object, for example after an update.
- Parameters:
object – The object to display
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed.
traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits.
cued – Specifies if it is cued on initialization
css_syle –
base: the css style of the box during initialization
cue: the css style that is added when :param traits_to_observe: in widget :param widgets_to_observe: changes. It is supposed to change the style of the box such that the user has a visual cue that :param widget_to_cue: has changed.
- class scwidgets.CueOutput(**kwargs: Any)[source]¶
A cued displayable ipywidget.Output for any Python object.
- Parameters:
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed.
traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits.
cued – Specifies if it is cued on initialization
css_syle –
base: the css style of the box during initialization
cue: the css style that is added when :param traits_to_observe: in widget :param widgets_to_observe: changes. It is supposed to change the style of the box such that the user has a visual cue that :param widget_to_cue: has changed.
- class scwidgets.ParametersPanel(**kwargs: Any)[source]¶
A wrapper around ipywidgets.interactive to have more control how to connect the parameters and the observation of parameters by buttons and the panels
- Parameters:
parameters – Can be any input that is allowed as keyword arguments in ipywidgets.interactive for the parameters. _options and other widget layout parameter are controlled by CodeExercise.
- property panel_parameters: Dict[str, Any]¶
- Returns:
Only parameters that are tunable in the parameter panel are returned. Fixed parameters are ignored.
- property panel_parameters_widget: List[Widget]¶
- Returns:
Only parameters that are tunable in the parameter panel are returned. Fixed parameters are ignored.
- property parameters: Dict[str, Any]¶
- Returns:
All parameters that were given on initialization are returned, also including also fixed parameters.
- class scwidgets.TextExercise(**kwargs: Any)[source]¶
- Parameters:
textarea – a custom textarea with custom styling, if not specified the standard parameters are given.
key – The key that is used to store the exercise in the json file.
description – A string describing the exercises that will be put into an HTML widget above the exercise.
title – A title for the exercise. If not given the key is used.
- property answer: dict¶
Translates the widget state into a string
exercise¶
- class scwidgets.exercise.CodeExercise(**kwargs: Any)[source]¶
A widget to demonstrate code interactively in a variety of ways. It is a combination of the several widgets that allow to check check, run and visualize code.
- Parameters:
code – A function or CodeInput that is the input of code
check_registry – A check registry that is used to register checks
exercise_registry – A exercise registry that is used to register the answers to save them later. If specified the save and load panel will appear.
key – The key that is used to store the exercise in the json file.
parameters – Input parameters for the
ParametersPanelclass or an initializedParametersPanelobject. Specifies the arguments in the parameter panel.update_mode – Determines how the parameters are refreshed on changes of the code input or parameters
outputs – List of CueOuputs that are drawn and refreshed
update – A function that is run during the update process. The function takes as argument the CodeExercise, so it can update all cue_ouputs
description – A string describing the exercises that will be put into an HTML widget above the exercise.
title – A title for the exercise. If not given the key is used.
- property answer: dict¶
Translates the widget state into a string
- compute_output_to_check(*args, **kwargs) Tuple[Any, ...][source]¶
The widget returns the output that will verified by the added checks.
- handle_checks_result(results: List[CheckResult | Exception])[source]¶
Function that controls how results of the checks are handled.
- handle_load_result(result: str | Exception)[source]¶
Function that controls how a load result is handled. If the result is a string, the loading was successfull. The result contains a string that can be outputed.
- handle_save_result(result: str | Exception)[source]¶
Function that controls how a save result is handled. If the result is a string, the saving was successfull. The result contains a string that can be outputed.
- property panel_parameters: Dict[str, FunInParamT]¶
- Returns:
Only parameters that are tunable in the parameter panel are returned. Fixed parameters are ignored.
- property parameters: Dict[str, FunInParamT]¶
- Returns:
All parameters that were given on initialization are returned, also including also fixed parameters.
- property parameters_panel: ParametersPanel | None¶
- Returns:
The parametergs panel widget.
- class scwidgets.exercise.ExerciseWidget(exercise_registry: None | ExerciseRegistry, exercise_key: None | Hashable)[source]¶
Any widget inheriting from this class can be (de)serialized
WidgetStateRegistry. The serialization offered by ipywidgets cannot be loaded out-of-the-box for restarted notebook since the widget IDs change- Parameters:
exercise_registry – the exercise registry that registers the answers for this widget
exercise_key – Identifier for the widget, must be unique for each regestired widget
Reference¶
https://ipywidgets.readthedocs.io/en/7.x/examples/Widget%20Low%20Level.html https://github.com/jupyter-widgets/ipywidgets/issues/2369
- property answer: dict¶
Translates the widget state into a string
- class scwidgets.exercise.TextExercise(**kwargs: Any)[source]¶
- Parameters:
textarea – a custom textarea with custom styling, if not specified the standard parameters are given.
key – The key that is used to store the exercise in the json file.
description – A string describing the exercises that will be put into an HTML widget above the exercise.
title – A title for the exercise. If not given the key is used.
- property answer: dict¶
Translates the widget state into a string
check¶
- class scwidgets.check.AssertResult(assert_name: str, parameter_indices: int | List[int], parameter_values: Any | List[Any], messages: str | List[str])[source]¶
- Parameters:
assert_name – TODO
parameter_indices – TODO
TODO…
- class scwidgets.check.Check(function_to_check: Callable[..., FunOutParamsT], asserts: List[AssertFunT] | AssertFunT, inputs_parameters: List[Dict[str, FunInParamT]] | Dict[str, FunInParamT] | None = None, outputs_references: List[tuple] | tuple | None = None, fingerprint: Callable[[Check.FunOutParamsT], Check.FingerprintT] | None = None, suppress_fingerprint_asserts: bool = True, stop_on_assert_error_raised: bool = True)[source]¶
A check verifies the correctness of a function for a set of inputs parameters using a list of univariate and bivariate asserts with the option to obscure the reference outputs.
- Parameters:
function_to_check – The function must that accepts each input parameters in :params input_parameters:
inputs_parameters – A dict or a list of dictionaries each containing the argument name and its value as (key, value) pair that is used as input for the function :param function_to_check:
outputs_references – A list or a list of lists each containing the expected output of the function :param function_to_check: of :param function_to_check: for the inputs in the :param input_parameters:
asserts – A list of assert functions. An assert function can the output parameters of :param function_to_check: to run assert. If output references has been set it can take additional output references to compare with. If a fingerprint is given then the fingerprints are compared while assert functions with a single argument are always applied on the output parameters.
fingerprint – A one-way function that takes as input the output parameters of function :param function_to_check: and obscures the :param output_references:.
suppress_fingerprint_asserts – Specifies if the assert messages that use the fingerprint function output for tests are surpressed. The message might be confusing to a student as the output is converted by the fingerprint function.
stop_on_assert_error_raised – Specifies if running the asserts is stopped as soon as an error is raised in an assert. If a lot of asserts are specified the printing of a lot of error tracebacks might make debugging harder.
- class scwidgets.check.CheckRegistry(**kwargs: Any)[source]¶
Manages the assignment of checks to widgets and the execution of checks. It allows to run the checks of all widgets and properly pipes the result to the corresponding function of the widget.
- property checks¶
all registerd checks from widgets to checks
- nb_conducted_asserts(widget: CheckableWidget)[source]¶
The total number of asserts that will be conducted for the widget
- Parameters:
widget – the checks of the widget are targeted
- class scwidgets.check.CheckableWidget(check_registry: CheckRegistry | None, name: str | None = None)[source]¶
A base class for any widget to inherit from to be compatible with the
CheckRegistry. The logic is th- Parameters:
check_registry – the check registry that registers the checks for this widget
name – Optional name of the widget that is shown in the messages of the checks
code¶
- class scwidgets.code.CodeInput(**kwargs: Any)[source]¶
Small wrapper around WidgetCodeInput that controls the output
- Parameters:
function – We can automatically parse the function. Note that during parsing the source code might be differently formatted and certain python functionalities are not formatted. If you notice undesired changes by the parsing, please directly specify the function as string using the other parameters.
function_name – The name of the function
function_paramaters – The parameters as continuous string as specified in the signature of the function. e.g for foo(x, y = 5) it should be “x, y = 5”
docstring – The docstring of the function
function_body – The function definition without indentation
builtins – A dict of variable name and value that is added to the globals __builtins__ and thus available on initialization
- compatible_with_signature(parameters: List[str]) str[source]¶
This function checks if the arguments are compatible with the function signature and returns a nonempty message if this is not the case explaining what the issue
- property function: LambdaType¶
Return the compiled function object wrapped by an try-catch block raising a CodeValidationError.
This can be assigned to a variable and then called, for instance:
func = widget.wrapped_function # This can raise a SyntaxError retval = func(parameters)
- Raises:
SyntaxError – if the function code has syntax errors (or if the function name is not a valid identifier)
- property unwrapped_function: LambdaType¶
Return the compiled function object.
This can be assigned to a variable and then called, for instance:
func = widget.wrapped_function # This can raise a SyntaxError retval = func(parameters)
- Raises:
SyntaxError – if the function code has syntax errors (or if the function name is not a valid identifier)
- class scwidgets.code.ParametersPanel(**kwargs: Any)[source]¶
A wrapper around ipywidgets.interactive to have more control how to connect the parameters and the observation of parameters by buttons and the panels
- Parameters:
parameters – Can be any input that is allowed as keyword arguments in ipywidgets.interactive for the parameters. _options and other widget layout parameter are controlled by CodeExercise.
- property panel_parameters: Dict[str, Any]¶
- Returns:
Only parameters that are tunable in the parameter panel are returned. Fixed parameters are ignored.
- property panel_parameters_widget: List[Widget]¶
- Returns:
Only parameters that are tunable in the parameter panel are returned. Fixed parameters are ignored.
- property parameters: Dict[str, Any]¶
- Returns:
All parameters that were given on initialization are returned, also including also fixed parameters.
cue¶
- class scwidgets.cue.CheckCueBox(**kwargs: Any)[source]¶
A box around the widget :param widget_to_cue: that adds a visual cue defined in the :param css_style: when the trait :param traits_to_observe: in the widget :param widgets_to_observe: changes.
- Parameters:
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed.
traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits.
widget_to_cue – The widget to wrap the box around to give a visual cue, once :param traits_to_observe: has changed If None, then the :param widget_to_cue: is set to :param widgets_to_observe:.
cued – Specifies if it is cued on initialization
Further accepts the same (keyword) arguments as
ipywidgets.Box.
- class scwidgets.cue.CheckResetCueButton(**kwargs: Any)[source]¶
A button that resets the cueing of the :param cue_widgets: on a successful action.
- Parameters:
cue_widgets – List of cue boxes the button resets on successuful click We assert that all boxes observe the same traits of the same widget
action – A callable that returns a boolean that specifies if the action was successul. If is called on a button click. The cues in :param cue_widgets: are removed if it was successful, if False nothing happens.
disable_on_successful_action – Specifies if the button should be disabled on a successful action
disable_during_action – Specifies if the button should be disabled during the action
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed. If
Nonethen widgets from :param cue_widgets: are taken.traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits. If
Nonethen traits from :param cue_widgets: are taken.cued – Specifies if it is cued on initialization. If
Nonethen the button is cued when :param cue_widgets: is cued.
Further accepts the same (keyword) arguments as
ipywidgets.Button.
- class scwidgets.cue.CueBox(**kwargs: Any)[source]¶
A box around the widget :param widget_to_cue: that adds a visual cue defined in the :param css_style: when the trait :param traits_to_observe: in the widget :param widgets_to_observe: changes. If the :param widgets_to_observe: is a list then for each widget is observed.
- Parameters:
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed.
traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits.
widget_to_cue – The widget to wrap the box around to give a visual cue, once :param traits_to_observe: has changed If None, then the :param widget_to_cue: is set to :param widgets_to_observe:.
cued – Specifies if it is cued on initialization
css_syle –
base: the css style of the box during initialization
cue: the css style that is added when :param traits_to_observe: in widget :param widgets_to_observe: changes. It is supposed to change the style of the box such that the user has a visual cue that :param widget_to_cue: has changed.
Further accepts the same (keyword) arguments as
ipywidgets.Box.
- class scwidgets.cue.CueFigure(**kwargs: Any)[source]¶
A cued displayable ipywidget.Output for a matplotlib figure. Provides utilities to clear and draw the updated figure. For the matplotlib inline backend it closes the active figure to prevent any display outside of the container, that happens on the creation of the figure because pyplot does magic behind the curtain that is hard to suppress. For the matplot interactive widget backend, named “nbagg”, it wraps te figure within.
- Parameters:
figure – The matplotlib figure
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed.
traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits.
cued – Specifies if it is cued on initialization
show_toolbars – Hide toolbars and headers when using in widget mode.
css_syle –
base: the css style of the box during initialization
cue: the css style that is added when :param traits_to_observe: in widget :param widgets_to_observe: changes. It is supposed to change the style of the box such that the user has a visual cue that :param widget_to_cue: has changed.
- clear_display(wait=False)[source]¶
- Parameters:
wait – same meaning as for the wait parameter in the ipywidgets.clear_output function
- class scwidgets.cue.CueObject(**kwargs: Any)[source]¶
A cued displayable ipywidget.Output for any Python object. Provides utilities to clear and redraw the object, for example after an update.
- Parameters:
object – The object to display
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed.
traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits.
cued – Specifies if it is cued on initialization
css_syle –
base: the css style of the box during initialization
cue: the css style that is added when :param traits_to_observe: in widget :param widgets_to_observe: changes. It is supposed to change the style of the box such that the user has a visual cue that :param widget_to_cue: has changed.
- class scwidgets.cue.CueOutput(**kwargs: Any)[source]¶
A cued displayable ipywidget.Output for any Python object.
- Parameters:
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed.
traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits.
cued – Specifies if it is cued on initialization
css_syle –
base: the css style of the box during initialization
cue: the css style that is added when :param traits_to_observe: in widget :param widgets_to_observe: changes. It is supposed to change the style of the box such that the user has a visual cue that :param widget_to_cue: has changed.
- class scwidgets.cue.CueWidget(widgets_to_observe: List[Widget] | Widget, traits_to_observe: str | Sentinel | List[str | Sentinel | List[str]] = 'value', cued: bool = True, *args, **kwargs)[source]¶
Observes a list of traits of widgets and sets cue when one of the widgets traits change. The behavior when the cue is set has to be implemented by children class.
- Parameters:
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed.
traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits.
cued – Specifies if it is cued on initialization
- class scwidgets.cue.ResetCueButton(**kwargs: Any)[source]¶
A button that resets the cueing of the :param cue_widgets: on a successful action.
- Parameters:
cue_widgets – List of cue boxes the button resets on successuful click We assert that all boxes observe the same traits of the same widget
action – A callable that returns a boolean that specifies if the action was successul. If is called on a button click. The cues in :param cue_widgets: are removed if it was successful, if False nothing happens.
disable_on_successful_action – Specifies if the button should be disabled on a successful action
disable_during_action – Specifies if the button should be disabled during the action
css_syle –
base: the css style of the box during initialization
cue: the css style that is added when :param traits_to_observe: in widget :param widget_to_observe: changes. It is supposed to change the style of the box such that the user has a visual cue that :param widget_to_cue: has changed.
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed. If
Nonethen widgets from :param cue_widgets: are taken.traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits. If
Nonethen traits from :param cue_widgets: are taken.cued – Specifies if it is cued on initialization. If
Nonethen the button is cued when :param cue_widgets: is cued.
Further accepts the same (keyword) arguments as
ipywidgets.Button.- set_cue_widgets(cue_widgets: List[CueWidget], overwrite_cue_observes: bool = True)[source]¶
- Parameters:
cue_widgets – List of cue boxes the button resets on successuful click We assert that all boxes observe the same traits of the same widget
overwrite_observes – specifies if observes related to cueing of button should be overwritten by the widgets ant traits of the :param cue_widgets:
- class scwidgets.cue.SaveCueBox(**kwargs: Any)[source]¶
A box around the widget :param widget_to_cue: that adds a visual cue defined in the :param css_style: when the trait :param traits_to_observe: in the widget :param widgets_to_observe: changes.
- Parameters:
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed.
traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits.
cued – Specifies if it is cued on initialization
widget_to_cue – The widget to wrap the box around to give a visual cue, once :param traits_to_observe: has changed If None, then the :param widget_to_cue: is set to :param widgets_to_observe:.
Further accepts the same (keyword) arguments as
ipywidgets.Box.
- class scwidgets.cue.SaveResetCueButton(**kwargs: Any)[source]¶
A button that resets the cueing of the :param cue_widgets: on a successful action.
- Parameters:
cue_widgets – List of cue boxes the button resets on successuful click We assert that all boxes observe the same traits of the same widget
action – A callable that returns a boolean that specifies if the action was successul. If is called on a button click. The cues in :param cue_widgets: are removed if it was successful, if False nothing happens.
disable_on_successful_action – Specifies if the button should be disabled on a successful action
disable_during_action – Specifies if the button should be disabled during the action
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed. If
Nonethen widgets from :param cue_widgets: are taken.traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits. If
Nonethen traits from :param cue_widgets: are taken.cued – Specifies if it is cued on initialization. If
Nonethen the button is cued when :param cue_widgets: is cued.
Further accepts the same (keyword) arguments as
ipywidgets.Button.
- class scwidgets.cue.UpdateCueBox(**kwargs: Any)[source]¶
A box around the widget :param widget_to_cue: that adds a visual cue defined in the :param css_style: when the trait :param traits_to_observe: in the widget :param widgets_to_observe: changes.
- Parameters:
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed.
traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits.
widget_to_cue – The widget to wrap the box around to give a visual cue, once :param traits_to_observe: has changed If None, then the :param widget_to_cue: is set to :param widgets_to_observe:.
cued – Specifies if it is cued on initialization
Further accepts the same (keyword) arguments as
ipywidgets.Box.
- class scwidgets.cue.UpdateResetCueButton(**kwargs: Any)[source]¶
A button that resets the cueing of the :param cue_widgets: on a successful action.
- Parameters:
cue_widgets – List of cue boxes the button resets on successuful click We assert that all boxes observe the same traits of the same widget
action – A callable that returns a boolean that specifies if the action was successul. If is called on a button click. The cues in :param cue_widgets: are removed if it was successful, if False nothing happens.
disable_on_successful_action – Specifies if the button should be disabled on a successful action
disable_during_action – Specifies if the button should be disabled during the action
widgets_to_observe – The widget to observe if the :param traits_to_observe: has changed. If
Nonethen widgets from :param cue_widgets: are taken.traits_to_observe – The trait from the :param widgets_to_observe: to observe if changed. Specify traitlets.All to observe all traits. If
Nonethen traits from :param cue_widgets: are taken.cued – Specifies if it is cued on initialization. If
Nonethen the button is cued when :param cue_widgets: is cued.
Further accepts the same (keyword) arguments as
ipywidgets.Button.