https://github.com/python/cpython/commit/29cb75dc109cfb4a57061ea8525cbc379101ae25
commit: 29cb75dc109cfb4a57061ea8525cbc379101ae25
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: terryjreedy <[email protected]>
date: 2026-07-15T03:34:53Z
summary:

[3.15] Remove duplicate button_ok code in idlelib.textview (GH-153733) (#153734)

Remove duplicate button_ok code in idlelib.textview (GH-153733)
(cherry picked from commit c5530cc836595aed61cbd0504c92e4d8fb996ed0)

Co-authored-by: Terry Jan Reedy <[email protected]>

files:
M Lib/idlelib/textview.py

diff --git a/Lib/idlelib/textview.py b/Lib/idlelib/textview.py
index 0f719a06883ad72..b326331efa7f9a1 100644
--- a/Lib/idlelib/textview.py
+++ b/Lib/idlelib/textview.py
@@ -92,10 +92,10 @@ def __init__(self, parent, contents, wrap='word'):
         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 @@ def __init__(self, parent, title, contents, modal=True, 
wrap=WORD,
         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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to