MCPcopy Index your code
hub / github.com/python/cpython / trace_add

Method trace_add

Lib/tkinter/__init__.py:458–471  ·  view source on GitHub ↗

Define a trace callback for the variable. Mode is one of "read", "write", "unset", or a list or tuple of such strings. Callback must be a function which is called when the variable is read, written or unset. Return the name of the callback.

(self, mode, callback)

Source from the content-addressed store, hash-verified

456 return cbname
457
458 def trace_add(self, mode, callback):
459 """Define a trace callback for the variable.
460
461 Mode is one of "read", "write", "unset", or a list or tuple of
462 such strings.
463 Callback must be a function which is called when the variable is
464 read, written or unset.
465
466 Return the name of the callback.
467 """
468 cbname = self._register(callback)
469 self._tk.call('trace', 'add', 'variable',
470 self._name, mode, (cbname,))
471 return cbname
472
473 def trace_remove(self, mode, cbname):
474 """Delete the trace callback for a variable.

Callers 4

test_traceMethod · 0.95
__init__Method · 0.80
test_trace_variableMethod · 0.80
attachMethod · 0.80

Calls 2

_registerMethod · 0.95
callMethod · 0.45

Tested by 2

test_traceMethod · 0.76
test_trace_variableMethod · 0.64