From 3bcb65037857df973ec6b97b00b93b477d829136 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 29 May 2021 01:09:47 -0400 Subject: [PATCH 1/4] bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons On macOS, tk sometimes defers to system settings. Customized white on system white meant unreadable text. --- Lib/turtledemo/__main__.py | 44 ++++++++++++------- .../2021-05-29-01-05-43.bpo-44254.f06xDm.rst | 1 + 2 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py index 12be5098dad274..4f34f887b66e97 100755 --- a/Lib/turtledemo/__main__.py +++ b/Lib/turtledemo/__main__.py @@ -124,7 +124,6 @@ def getExampleEntries(): ) - class DemoWindow(object): def __init__(self, filename=None): @@ -171,15 +170,23 @@ def __init__(self, filename=None): self.output_lbl = Label(root, height= 1, text=" --- ", bg="#ddf", font=("Arial", 16, 'normal'), borderwidth=2, relief=RIDGE) - self.start_btn = Button(root, text=" START ", font=btnfont, - fg="white", disabledforeground = "#fed", - command=self.startDemo) - self.stop_btn = Button(root, text=" STOP ", font=btnfont, - fg="white", disabledforeground = "#fed", - command=self.stopIt) - self.clear_btn = Button(root, text=" CLEAR ", font=btnfont, - fg="white", disabledforeground="#fed", - command = self.clearCanvas) + if darwin: # Leave Mac button colors alone - #44254. + self.start_btn = Button(root, text=" START ", font=btnfont, + command=self.startDemo) + self.stop_btn = Button(root, text=" STOP ", font=btnfont, + command=self.stopIt) + self.clear_btn = Button(root, text=" CLEAR ", font=btnfont, + command = self.clearCanvas) + else: + self.start_btn = Button(root, text=" START ", font=btnfont, + fg="white", disabledforeground = "#fed", + command=self.startDemo) + self.stop_btn = Button(root, text=" STOP ", font=btnfont, + fg="white", disabledforeground = "#fed", + command=self.stopIt) + self.clear_btn = Button(root, text=" CLEAR ", font=btnfont, + fg="white", disabledforeground="#fed", + command = self.clearCanvas) self.output_lbl.grid(row=1, column=0, sticky='news', padx=(0,5)) self.start_btn.grid(row=1, column=1, sticky='ew') self.stop_btn.grid(row=1, column=2, sticky='ew') @@ -267,12 +274,17 @@ def update_mousewheel(self, event): return self.increase_size() def configGUI(self, start, stop, clear, txt="", color="blue"): - self.start_btn.config(state=start, - bg="#d00" if start == NORMAL else "#fca") - self.stop_btn.config(state=stop, - bg="#d00" if stop == NORMAL else "#fca") - self.clear_btn.config(state=clear, - bg="#d00" if clear == NORMAL else "#fca") + if darwin: # Leave Mac button colors alone - #44254. + self.start_btn.config(state=start) + self.stop_btn.config(state=stop) + self.clear_btn.config(state=clear) + else: + self.start_btn.config(state=start, + bg="#d00" if start == NORMAL else "#fca") + self.stop_btn.config(state=stop, + bg="#d00" if stop == NORMAL else "#fca") + self.clear_btn.config(state=clear, + bg="#d00" if clear == NORMAL else "#fca") self.output_lbl.config(text=txt, fg=color) def makeLoadDemoMenu(self, master): diff --git a/Misc/NEWS.d/next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst b/Misc/NEWS.d/next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst new file mode 100644 index 00000000000000..113096baa77741 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst @@ -0,0 +1 @@ +On Mac, remove disfunctional colors from turtledemo buttons. From e4a4ca7bde684de3243af2dbc7cfb5b9eeacec15 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 29 May 2021 01:53:36 -0400 Subject: [PATCH 2/4] For Mac, add fg color that works on white and black. --- Lib/turtledemo/__main__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py index 4f34f887b66e97..caea022da4a688 100755 --- a/Lib/turtledemo/__main__.py +++ b/Lib/turtledemo/__main__.py @@ -172,11 +172,11 @@ def __init__(self, filename=None): relief=RIDGE) if darwin: # Leave Mac button colors alone - #44254. self.start_btn = Button(root, text=" START ", font=btnfont, - command=self.startDemo) + fg='#00cc22', command=self.startDemo) self.stop_btn = Button(root, text=" STOP ", font=btnfont, - command=self.stopIt) + fg='#00cc22', command=self.stopIt) self.clear_btn = Button(root, text=" CLEAR ", font=btnfont, - command = self.clearCanvas) + fg='#00cc22', command = self.clearCanvas) else: self.start_btn = Button(root, text=" START ", font=btnfont, fg="white", disabledforeground = "#fed", From f138347e85882abc5d28e072fa6898a67a5dabbb Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 29 May 2021 01:57:51 -0400 Subject: [PATCH 3/4] Update 2021-05-29-01-05-43.bpo-44254.f06xDm.rst --- .../next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst b/Misc/NEWS.d/next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst index 113096baa77741..a847b98f6d6b8a 100644 --- a/Misc/NEWS.d/next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst +++ b/Misc/NEWS.d/next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst @@ -1 +1,2 @@ -On Mac, remove disfunctional colors from turtledemo buttons. +On Mac, give turtledemo button text a color that works on light and +dark background. Programmers cannot control the latter. From 4d59d67339bc70dbe8135e85cac362a74183b90b Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Sat, 29 May 2021 01:58:39 -0400 Subject: [PATCH 4/4] Update 2021-05-29-01-05-43.bpo-44254.f06xDm.rst --- .../next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS.d/next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst b/Misc/NEWS.d/next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst index a847b98f6d6b8a..7438d5ce044b87 100644 --- a/Misc/NEWS.d/next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst +++ b/Misc/NEWS.d/next/Library/2021-05-29-01-05-43.bpo-44254.f06xDm.rst @@ -1,2 +1,2 @@ -On Mac, give turtledemo button text a color that works on light and -dark background. Programmers cannot control the latter. +On Mac, give turtledemo button text a color that works on both light +or dark background. Programmers cannot control the latter.