Define a trace callback for the variable. MODE is one of "r", "w", "u" for read, write, undefine. CALLBACK must be a function which is called when the variable is read, written or undefined. Return the name of the callback. This deprecated method wraps a de
(self, mode, callback)
| 496 | splitlist(self._tk.call('trace', 'info', 'variable', self._name)))] |
| 497 | |
| 498 | def trace_variable(self, mode, callback): |
| 499 | """Define a trace callback for the variable. |
| 500 | |
| 501 | MODE is one of "r", "w", "u" for read, write, undefine. |
| 502 | CALLBACK must be a function which is called when |
| 503 | the variable is read, written or undefined. |
| 504 | |
| 505 | Return the name of the callback. |
| 506 | |
| 507 | This deprecated method wraps a deprecated Tcl method removed |
| 508 | in Tcl 9.0. Use trace_add() instead. |
| 509 | """ |
| 510 | import warnings |
| 511 | warnings.warn( |
| 512 | "trace_variable() is deprecated and not supported with Tcl 9; " |
| 513 | "use trace_add() instead.", |
| 514 | DeprecationWarning, stacklevel=2) |
| 515 | cbname = self._register(callback) |
| 516 | self._tk.call("trace", "variable", self._name, mode, cbname) |
| 517 | return cbname |
| 518 | |
| 519 | trace = trace_variable |
| 520 |