summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-04-27 19:32:59 (GMT)
committerGuido van Rossum <guido@python.org>1998-04-27 19:32:59 (GMT)
commite86271af72ae66aa79b33106b900053446923ef4 (patch)
treec2c20dfea3a9ea22018f59a0f3a152a4c8936f83 /Lib
parent1f41f846a3fc369c4d68eee962a059ca3a51ccf3 (diff)
downloadcpython-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')
-rw-r--r--Lib/lib-tk/Tkinter.py5
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,)