classification
Title: Change turtledemo button colors
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: miss-islington, ned.deily, taleinat, terry.reedy
Priority: normal Keywords: patch

Created on 2021-05-27 20:49 by terry.reedy, last changed 2021-05-29 08:16 by terry.reedy.

Pull Requests
URL Status Linked Edit
PR 26448 merged terry.reedy, 2021-05-29 05:10
PR 26449 merged miss-islington, 2021-05-29 07:19
PR 26450 merged miss-islington, 2021-05-29 07:20
Messages (12)
msg394597 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-05-27 20:49
[Following up on #44243.]
tk/tkinter-based turtledemo buttons are currently white on something.  On Mac, configured foreground button colors are honored (while the button is unpressed), while background colors are ignored.  Given that the unpressed default is black on white, the configured result of white on something is white on white.

I don't like the current colors anyway, so I think we should change to something on white.  I am thinking of green, red, and blue for Start, Stop, and Clear.
msg394700 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-05-28 22:50
One quick comment: one shouldn't assume what colors are being used on current macOS systems and a current Tk, like on macOS 11 Big Sur and Tk 8.6.11.  The foreground and background colors can depend on what system appearance is selected by the user (System Preferences -> General -> Appearance: Light/Dark/Auto). Changing the system appearance to Dark causes the Turtle Demo buttons to have a darker background and so the white text labels are now quite visible.  I don't know what the best solution is but it shouldn't be based on the assumption that the colors are fixed.
msg394713 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-05-29 04:19
I am going to disable color config on darwin (and hope it gets into b2).  The default should always work.
msg394714 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-05-29 04:24
Ned, could you check the darwin osascript in turtledemo.__main__, lines 138-149 is current (both needed and correct)?

            subprocess.run(
                    [
                        'osascript',
                        '-e', 'tell application "System Events"',
                        '-e', 'set frontmost of the first process whose '
                              'unix id is {} to true'.format(os.getpid()),
                        '-e', 'end tell',
                    ],
                    stderr=subprocess.DEVNULL,
                    stdout=subprocess.DEVNULL,)

The one line could be an fstring now.
msg394715 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-05-29 05:13
I did a quick check and it looks like the code may not be needed on the latest macOS and Tk versions; however, I did not go back and check it on older systems and, in any case, it doesn't cause seem to cause any harm and it still does what it is supposed to do: ensure that the turtledemo process is the frontmost, active one regardless of what the OS or Tk may do.
msg394716 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-05-29 05:20
I also just did a quick test of PR 25448. The current version seems to have swapped one problem for another: now button labels are legible when the Light mode appearance is in effect but the labels blend into the button background when in Dark mode, the opposite of the current behavior.
msg394717 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-05-29 05:35
I presume you tested pr_26448.  If default colors do not work, that is on tcl/tk.  I suspect 8.6.11 is not prepared for dark theme.  The underlying bug is ignoring the tk/user setting and deferring to the system for background only.

In the meanwhile, I will try to set the forground to something at least readable on either background.  Is the dark theme background black as opposed to dark something?
msg394718 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-05-29 05:39
Of course, I cannot set the background on my Mac, so I will test on Windows and let you verify on dark theme mac
msg394719 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-05-29 05:55
I picked a bluish green that works on both white and black on Windows.  Test is you can and wish.
msg394720 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-05-29 07:20
New changeset af5a324843de395cecc562cb0c757b3768f2077f by Terry Jan Reedy in branch 'main':
bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons (GH-26448)
https://github.com/python/cpython/commit/af5a324843de395cecc562cb0c757b3768f2077f
msg394723 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-05-29 07:35
New changeset addd32986f703e692463828ac0014023a901010f by Miss Islington (bot) in branch '3.10':
bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons (GH-26448)
https://github.com/python/cpython/commit/addd32986f703e692463828ac0014023a901010f
msg394725 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-05-29 08:16
New changeset 9bcb76c24f6d3f01e596a439c1521f9099e3fe80 by Miss Islington (bot) in branch '3.9':
bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons (GH-26448)
https://github.com/python/cpython/commit/9bcb76c24f6d3f01e596a439c1521f9099e3fe80
History
Date User Action Args
2021-05-29 08:16:42terry.reedysetmessages: + msg394725
2021-05-29 07:35:06terry.reedysetmessages: + msg394723
2021-05-29 07:20:10terry.reedysetmessages: + msg394720
2021-05-29 07:20:04miss-islingtonsetpull_requests: + pull_request25044
2021-05-29 07:19:59miss-islingtonsetnosy: + miss-islington

pull_requests: + pull_request25043
stage: needs patch -> patch review
2021-05-29 05:55:09terry.reedysetmessages: + msg394719
2021-05-29 05:39:10terry.reedysetmessages: + msg394718
2021-05-29 05:35:13terry.reedysetnosy: + taleinat

messages: + msg394717
stage: patch review -> needs patch
2021-05-29 05:20:18ned.deilysetmessages: + msg394716
2021-05-29 05:13:09ned.deilysetmessages: + msg394715
2021-05-29 05:10:53terry.reedysetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request25042
2021-05-29 04:24:29terry.reedysetmessages: + msg394714
2021-05-29 04:19:42terry.reedysetmessages: + msg394713
2021-05-28 22:50:28ned.deilysetnosy: + ned.deily
messages: + msg394700
2021-05-27 20:49:58terry.reedycreate