]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] Remove duplicate button_ok code in idlelib.textview (GH-153733) (#153735)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 15 Jul 2026 03:31:05 +0000 (05:31 +0200)
committerGitHub <noreply@github.com>
Wed, 15 Jul 2026 03:31:05 +0000 (03:31 +0000)
Remove duplicate button_ok code in idlelib.textview (GH-153733)
(cherry picked from commit c5530cc836595aed61cbd0504c92e4d8fb996ed0)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Lib/idlelib/textview.py

index 0f719a06883ad726e860a70f3d39829f1dbd1b7b..b326331efa7f9a175bfc42e73b1a03733a9f0863 100644 (file)
@@ -92,10 +92,10 @@ class ViewFrame(Frame):
         color_config(text)
         text.focus_set()
 
-        self.button_ok = button_ok = Button(
+        self.button_ok = Button(
                 self, text='Close', command=self.ok, takefocus=False)
         self.textframe.pack(side='top', expand=True, fill='both')
-        button_ok.pack(side='bottom')
+        self.button_ok.pack(side='bottom')
 
     def ok(self, event=None):
         """Dismiss text viewer dialog."""
@@ -127,10 +127,8 @@ class ViewWindow(Toplevel):
         self.geometry(f'=750x500+{x}+{y}')
 
         self.title(title)
-        self.viewframe = ViewFrame(self, contents, wrap=wrap)
         self.protocol("WM_DELETE_WINDOW", self.ok)
-        self.button_ok = Button(self, text='Close',
-                                command=self.ok, takefocus=False)
+        self.viewframe = ViewFrame(self, contents, wrap=wrap)
         self.viewframe.pack(side='top', expand=True, fill='both')
 
         self.is_modal = modal