diff options
author | Guido van Rossum <guido@python.org> | 1998-04-27 19:32:59 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-04-27 19:32:59 (GMT) |
commit | e86271af72ae66aa79b33106b900053446923ef4 (patch) | |
tree | c2c20dfea3a9ea22018f59a0f3a152a4c8936f83 /Lib/lib-tk | |
parent | 1f41f846a3fc369c4d68eee962a059ca3a51ccf3 (diff) | |
download | cpython-e86271af72ae66aa79b33106b900053446923ef4.zip cpython-e86271af72ae66aa79b33106b900053446923ef4.tar.gz cpython-e86271af72ae66aa79b33106b900053446923ef4.tar.bz2 |
When setting the event structure fields, don't die when the widget
name is not registered; simply use the string. This happens for
tear-off widgets (e.g. if you've registered enter/leave events for the
menu).
Diffstat (limited to 'Lib/lib-tk')
-rw-r--r-- | Lib/lib-tk/Tkinter.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index 7ac6a0f..bc7dae7 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -585,7 +585,10 @@ class Misc: e.keysym = K e.keysym_num = tk.getint(N) e.type = T - e.widget = self._nametowidget(W) + try: + e.widget = self._nametowidget(W) + except KeyError: + e.widget = W e.x_root = tk.getint(X) e.y_root = tk.getint(Y) return (e,) |