From 60586de02de074a33c015e5a013d85d0b17e7e61 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Thu, 2 Aug 2018 00:52:22 -0700 Subject: [PATCH] bpo-34120: fix text viewer to call grab_release() only when needed (GH-8616) (cherry picked from commit dd74369cb7b230b07ac3a031563406c8f2aae17f) Co-authored-by: Tal Einat --- Lib/idlelib/textview.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/textview.py b/Lib/idlelib/textview.py index e78e297ab99..75b24703b4c 100644 --- a/Lib/idlelib/textview.py +++ b/Lib/idlelib/textview.py @@ -83,7 +83,8 @@ class ViewWindow(Toplevel): command=self.ok, takefocus=False) self.viewframe.pack(side='top', expand=True, fill='both') - if modal: + self.is_modal = modal + if self.is_modal: self.transient(parent) self.grab_set() if not _utest: @@ -91,7 +92,8 @@ class ViewWindow(Toplevel): def ok(self, event=None): """Dismiss text viewer dialog.""" - self.grab_release() + if self.is_modal: + self.grab_release() self.destroy()