mirror of https://github.com/python/cpython.git
bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons (GH-26448)
On macOS, tk defers to system setting for button background when in normal state. Give turtledemo button text a color that works on either light or dark background.
This commit is contained in:
parent
43cf7c864a
commit
af5a324843
|
@ -124,7 +124,6 @@ def getExampleEntries():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DemoWindow(object):
|
class DemoWindow(object):
|
||||||
|
|
||||||
def __init__(self, filename=None):
|
def __init__(self, filename=None):
|
||||||
|
@ -171,15 +170,23 @@ def __init__(self, filename=None):
|
||||||
self.output_lbl = Label(root, height= 1, text=" --- ", bg="#ddf",
|
self.output_lbl = Label(root, height= 1, text=" --- ", bg="#ddf",
|
||||||
font=("Arial", 16, 'normal'), borderwidth=2,
|
font=("Arial", 16, 'normal'), borderwidth=2,
|
||||||
relief=RIDGE)
|
relief=RIDGE)
|
||||||
self.start_btn = Button(root, text=" START ", font=btnfont,
|
if darwin: # Leave Mac button colors alone - #44254.
|
||||||
fg="white", disabledforeground = "#fed",
|
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,
|
self.stop_btn = Button(root, text=" STOP ", font=btnfont,
|
||||||
fg="white", disabledforeground = "#fed",
|
fg='#00cc22', command=self.stopIt)
|
||||||
command=self.stopIt)
|
self.clear_btn = Button(root, text=" CLEAR ", font=btnfont,
|
||||||
self.clear_btn = Button(root, text=" CLEAR ", font=btnfont,
|
fg='#00cc22', command = self.clearCanvas)
|
||||||
fg="white", disabledforeground="#fed",
|
else:
|
||||||
command = self.clearCanvas)
|
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.output_lbl.grid(row=1, column=0, sticky='news', padx=(0,5))
|
||||||
self.start_btn.grid(row=1, column=1, sticky='ew')
|
self.start_btn.grid(row=1, column=1, sticky='ew')
|
||||||
self.stop_btn.grid(row=1, column=2, 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()
|
return self.increase_size()
|
||||||
|
|
||||||
def configGUI(self, start, stop, clear, txt="", color="blue"):
|
def configGUI(self, start, stop, clear, txt="", color="blue"):
|
||||||
self.start_btn.config(state=start,
|
if darwin: # Leave Mac button colors alone - #44254.
|
||||||
bg="#d00" if start == NORMAL else "#fca")
|
self.start_btn.config(state=start)
|
||||||
self.stop_btn.config(state=stop,
|
self.stop_btn.config(state=stop)
|
||||||
bg="#d00" if stop == NORMAL else "#fca")
|
self.clear_btn.config(state=clear)
|
||||||
self.clear_btn.config(state=clear,
|
else:
|
||||||
bg="#d00" if clear == NORMAL else "#fca")
|
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)
|
self.output_lbl.config(text=txt, fg=color)
|
||||||
|
|
||||||
def makeLoadDemoMenu(self, master):
|
def makeLoadDemoMenu(self, master):
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
On Mac, give turtledemo button text a color that works on both light
|
||||||
|
or dark background. Programmers cannot control the latter.
|
Loading…
Reference in New Issue