diff options
author | Guido van Rossum <guido@python.org> | 1998-06-25 18:54:49 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-06-25 18:54:49 (GMT) |
commit | 88b63b8d30e57849c184e30c5fd0388701fef9ae (patch) | |
tree | 14314da282683f82e48f914c51c5274554f8d074 /Lib | |
parent | e5836d981122fdda8c41282d0ba8e05b6c806809 (diff) | |
download | cpython-88b63b8d30e57849c184e30c5fd0388701fef9ae.zip cpython-88b63b8d30e57849c184e30c5fd0388701fef9ae.tar.gz cpython-88b63b8d30e57849c184e30c5fd0388701fef9ae.tar.bz2 |
Allow binding a Tcl command (given as a string) as well as a Python
function.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index d7e73cf..3a7b8c0 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -450,7 +450,9 @@ class Misc: else: self.tk.call('bindtags', self._w, tagList) def _bind(self, what, sequence, func, add, needcleanup=1): - if func: + if type(func) is StringType: + self.tk.call(what + (sequence, func)) + elif func: funcid = self._register(func, self._substitute, needcleanup) cmd = ('%sif {"[%s %s]" == "break"} break\n' @@ -460,8 +462,6 @@ class Misc: _string.join(self._subst_format))) self.tk.call(what + (sequence, cmd)) return funcid - elif func == '': - self.tk.call(what + (sequence, func)) else: return self.tk.call(what + (sequence,)) def bind(self, sequence=None, func=None, add=None): |