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).
This commit is contained in:
Guido van Rossum 1998-04-27 19:32:59 +00:00
parent 1f41f846a3
commit e86271af72
1 changed files with 4 additions and 1 deletions

View File

@ -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,)