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

Change turtledemo button colors #88420

Open
terryjreedy opened this issue May 27, 2021 · 13 comments
Open

Change turtledemo button colors #88420

terryjreedy opened this issue May 27, 2021 · 13 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 44254
Nosy @terryjreedy, @taleinat, @ned-deily, @miss-islington
PRs
  • bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons #26448
  • [3.10] bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons (GH-26448) #26449
  • [3.9] bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons (GH-26448) #26450
  • 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:

    assignee = None
    closed_at = None
    created_at = <Date 2021-05-27.20:49:58.696>
    labels = ['type-bug', 'library', '3.9', '3.10', '3.11']
    title = 'Change turtledemo button colors'
    updated_at = <Date 2021-05-29.08:16:42.946>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2021-05-29.08:16:42.946>
    actor = 'terry.reedy'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2021-05-27.20:49:58.696>
    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']

    @terryjreedy
    Copy link
    Member Author

    terryjreedy commented May 27, 2021

    [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.

    @terryjreedy terryjreedy added 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels May 27, 2021
    @ned-deily
    Copy link
    Member

    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.

    @terryjreedy
    Copy link
    Member Author

    I am going to disable color config on darwin (and hope it gets into b2). The default should always work.

    @terryjreedy
    Copy link
    Member Author

    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.

    @ned-deily
    Copy link
    Member

    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.

    @ned-deily
    Copy link
    Member

    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.

    @terryjreedy
    Copy link
    Member Author

    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?

    @terryjreedy
    Copy link
    Member Author

    Of course, I cannot set the background on my Mac, so I will test on Windows and let you verify on dark theme mac

    @terryjreedy
    Copy link
    Member Author

    terryjreedy commented May 29, 2021

    I picked a bluish green that works on both white and black on Windows. Test if you can and wish.

    @terryjreedy
    Copy link
    Member Author

    New changeset af5a324 by Terry Jan Reedy in branch 'main':
    bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons (GH-26448)
    af5a324

    @terryjreedy
    Copy link
    Member Author

    New changeset addd329 by Miss Islington (bot) in branch '3.10':
    bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons (GH-26448)
    addd329

    @terryjreedy
    Copy link
    Member Author

    New changeset 9bcb76c by Miss Islington (bot) in branch '3.9':
    bpo-44254: On Mac, remove disfunctional colors from turtledemo buttons (GH-26448)
    9bcb76c

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @furkanonder
    Copy link
    Sponsor Contributor

    @terryjreedy The issue seems to be solved. We can close the issue.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    Status: No status
    Development

    No branches or pull requests

    3 participants