Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons #26448

Merged
merged 4 commits into from May 29, 2021

Conversation

@terryjreedy
Copy link
Member

@terryjreedy terryjreedy commented May 29, 2021

On macOS, tk partly defers to system settings. Custom white
on system white meant unreadable text.

https://bugs.python.org/issue44254

On macOS, tk sometimes defers to system settings.  Customized white
on system white meant unreadable text.
self.clear_btn = Button(root, text=" CLEAR ", font=btnfont,
fg="white", disabledforeground="#fed",
command = self.clearCanvas)
if darwin: # Leave Mac button colors alone - #44254.
Copy link
Member

@serhiy-storchaka serhiy-storchaka May 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It duplicates a lot of code which is the same on all platforms. Would not be better to factor out variable parts?

if darwin:
    foreground = ...
    disabledforeground = ...
else:
    foreground = ...
    disabledforeground = ...

Copy link
Member Author

@terryjreedy terryjreedy May 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interim patch changing Mac only that I hope gets into .0b2 to workaround the tk bug on Mac (see issue). I initially removed both colors for Mac, but the default buttons are buggy depending on the users choice of theme. The default disabled foreground on Mac is fine as far as I know, and I don't especially care as being readable then does not matter. After I decide what to do with non-Mac, I will consider whether to even set disabledforeground on non-Mac. I want to try multiple colors on non-Mac, and if so, the code will not be exactly parallel. And maybe use ttk widgets.

@terryjreedy terryjreedy merged commit af5a324 into python:main May 29, 2021
12 checks passed
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented May 29, 2021

Thanks @terryjreedy for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.9.
🐍🍒🤖

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented May 29, 2021

GH-26449 is a backport of this pull request to the 3.10 branch.

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented May 29, 2021

GH-26450 is a backport of this pull request to the 3.9 branch.

miss-islington added a commit to miss-islington/cpython that referenced this issue May 29, 2021
pythonGH-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.
(cherry picked from commit af5a324)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
miss-islington added a commit to miss-islington/cpython that referenced this issue May 29, 2021
pythonGH-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.
(cherry picked from commit af5a324)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
terryjreedy added a commit that referenced this issue May 29, 2021
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.
(cherry picked from commit af5a324)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
terryjreedy added a commit that referenced this issue May 29, 2021
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.
(cherry picked from commit af5a324)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
JuniorJPDJ added a commit to JuniorJPDJ/cpython that referenced this issue Aug 12, 2021
pythonGH-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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants