diff options
author | Guido van Rossum <guido@python.org> | 1997-01-21 23:22:03 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-01-21 23:22:03 (GMT) |
commit | 76f587b7f8d10372f0efc4be94239f3d73c92421 (patch) | |
tree | efd5e2369753342cca201c92dcf891de06099bc6 /Lib/tkinter | |
parent | b7cf5bb1c2c16a39605a7aede18a2aff09054662 (diff) | |
download | cpython-76f587b7f8d10372f0efc4be94239f3d73c92421.zip cpython-76f587b7f8d10372f0efc4be94239f3d73c92421.tar.gz cpython-76f587b7f8d10372f0efc4be94239f3d73c92421.tar.bz2 |
Avoid traceback in selection_own_get() when no Tk widget owns the
selection; return None instead.
Diffstat (limited to 'Lib/tkinter')
-rwxr-xr-x | Lib/tkinter/Tkinter.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/tkinter/Tkinter.py b/Lib/tkinter/Tkinter.py index 9fb1d02..a19cf50 100755 --- a/Lib/tkinter/Tkinter.py +++ b/Lib/tkinter/Tkinter.py @@ -267,9 +267,10 @@ class Misc: def selection_own_get(self, **kw): "Find owner of X selection." if not kw.has_key('displayof'): kw['displayof'] = self._w - return self._nametowidget( - apply(self.tk.call, - ('selection', 'own') + self._options(kw))) + name = apply(self.tk.call, + ('selection', 'own') + self._options(kw)) + if not name: return None + return self._nametowidget(name) def send(self, interp, cmd, *args): return apply(self.tk.call, ('send', interp, cmd) + args) def lower(self, belowThis=None): |