_register_validator
- Widget._register_validator(handler: Callable[[...], None], names: tuple[str | Sentinel, ...]) None
Setup a handler to be called when a trait should be cross validated.
This is used to setup dynamic notifications for cross-validation.
If a validator is already registered for any of the provided names, a TraitError is raised and no new validator is registered.
- Parameters:
handler (callable) –
A callable that is called when the given trait is cross-validated. Its signature is handler(proposal), where proposal is a Bunch (dictionary with attribute access) with the following attributes/keys:
owner: the HasTraits instancevalue: the proposed value for the modified trait attributetrait: the TraitType instance associated with the attribute
names (List of strings) – The names of the traits that should be cross-validated