Open terryjreedy opened 3 years ago
[Following up on #88409.] 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.
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.
I am going to disable color config on darwin (and hope it gets into b2). The default should always work.
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.
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.
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.
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?
Of course, I cannot set the background on my Mac, so I will test on Windows and let you verify on dark theme mac
I picked a bluish green that works on both white and black on Windows. Test if you can and wish.
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
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
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
@terryjreedy The issue seems to be solved. We can close the issue.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at = None created_at =
labels = ['type-bug', 'library', '3.9', '3.10', '3.11']
title = 'Change turtledemo button colors'
updated_at =
user = 'https://github.com/terryjreedy'
```
bugs.python.org fields:
```python
activity =
actor = 'terry.reedy'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation =
creator = 'terry.reedy'
dependencies = []
files = []
hgrepos = []
issue_num = 44254
keywords = ['patch']
message_count = 12.0
messages = ['394597', '394700', '394713', '394714', '394715', '394716', '394717', '394718', '394719', '394720', '394723', '394725']
nosy_count = 4.0
nosy_names = ['terry.reedy', 'taleinat', 'ned.deily', 'miss-islington']
pr_nums = ['26448', '26449', '26450']
priority = 'normal'
resolution = None
stage = 'patch review'
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue44254'
versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']
```