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)
| 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. |