From c5530cc836595aed61cbd0504c92e4d8fb996ed0 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Tue, 14 Jul 2026 23:03:35 -0400 Subject: [PATCH] Remove duplicate button_ok code in idlelib.textview (#153733) --- Lib/idlelib/textview.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Lib/idlelib/textview.py b/Lib/idlelib/textview.py index 0f719a06883a..b326331efa7f 100644 --- a/Lib/idlelib/textview.py +++ b/Lib/idlelib/textview.py @@ -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 -- 2.47.3