, parameter_names, what='value', onlychanged=True, queued=False, precedence=0)[source]#

Register the given callback function fn to be invoked for events on the indicated parameters.

what: What to watch on each parameter; either the value (by default) or else the indicated slot (e.g. ‘constant’).

onlychanged: By default, only invokes the function when the watched item changes, but if onlychanged=False also invokes it when the what item is set to its current value again.

queued: By default, additional watcher events generated inside the callback fn are dispatched immediately, effectively doing depth-first processing of Watcher events. However, in certain scenarios, it is helpful to wait to dispatch such downstream events until all events that triggered this watcher have been processed. In such cases setting queued=True on this Watcher will queue up new downstream events generated during fn until fn completes and all other watchers invoked by that same event have finished executing), effectively doing breadth-first processing of Watcher events.

precedence: Declares a precedence level for the Watcher that determines the priority with which the callback is executed. Lower precedence levels are executed earlier. Negative precedences are reserved for internal Watchers, i.e. those set up by param.depends.

When the fn is called, it will be provided the relevant Event objects as positional arguments, which allows it to determine which of the possible triggering events occurred.

Returns a Watcher object.

See help(Watcher) and help(Event) for the contents of those objects.