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

IDLE colors: avoid no-contrast popups and dialogs. #52197

Closed
panzi mannequin opened this issue Feb 17, 2010 · 12 comments
Closed

IDLE colors: avoid no-contrast popups and dialogs. #52197

panzi mannequin opened this issue Feb 17, 2010 · 12 comments
Assignees
Labels
3.10 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@panzi
Copy link
Mannequin

panzi mannequin commented Feb 17, 2010

BPO 7949
Nosy @terryjreedy, @serwy, @roseman, @csabella
Superseder
  • bpo-36176: Fix IDLE Autocomplete / Calltip Window Colors
  • Files
  • idlelib.zip: patched version of ToolTip.py, AutoCompleteWindow.py and CallTipWindow.py
  • idlelib.zip: patched version of ToolTip.py, AutoCompleteWindow.py, CallTipWindow.py, Debugger.py and ScrolledList.py
  • 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 = 'https://github.com/terryjreedy'
    closed_at = <Date 2020-06-09.13:22:11.882>
    created_at = <Date 2010-02-17.02:01:51.982>
    labels = ['expert-IDLE', 'type-bug', '3.10']
    title = 'IDLE: avoid no-contrast popups and dialogs.'
    updated_at = <Date 2020-06-09.13:22:11.881>
    user = 'https://bugs.python.org/panzi'

    bugs.python.org fields:

    activity = <Date 2020-06-09.13:22:11.881>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2020-06-09.13:22:11.882>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2010-02-17.02:01:51.982>
    creator = 'panzi'
    dependencies = []
    files = ['16240', '16258']
    hgrepos = []
    issue_num = 7949
    keywords = []
    message_count = 12.0
    messages = ['99457', '99458', '99578', '99579', '99580', '180120', '231203', '251562', '267582', '370842', '371100', '371104']
    nosy_count = 6.0
    nosy_names = ['terry.reedy', 'panzi', 'roger.serwy', 'markroseman', 'sahin', 'cheryl.sabella']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '36176'
    type = 'behavior'
    url = 'https://bugs.python.org/issue7949'
    versions = ['Python 3.10']

    @panzi
    Copy link
    Mannequin Author

    panzi mannequin commented Feb 17, 2010

    Idle sets *some* colors to hardcoded values and uses the system defaults for other colors. This is extremely bad when you use a dark gtk color scheme and now a almost white text (system text color) is displayed on a white background (idle tooltip background color).

    There are two solutions to the problem: Also set the foreground color to a hardcoded value or better detect whether the foreground color is bright or dark and choose an appropriate background color. I've implemented the latter for the idle that comes with fedora 12 (2.6.2). I forgot to backup the original files so I can't make a diff/patch. However, I attached the changed files and here is a summary of my changes:

    in idlelib/ToolTip.py:
    added functions:
    parse_color(color)
    set_tooltip_bg(widget)

    in ToolTipBase.showcontents():
    set_tooltip_bg(label)

    in ListboxToolTip.showcontents():
    set_tooltip_bg(listbox)

    in idlelib/AutoCompleteWindow.py:
    added:
    from ToolTip import set_tooltip_bg

    in AutoCompleteWindow.show_window():
    set_tooltip_bg(listbox)

    in idlelib/CallTipWindow.py:
    added:
    from ToolTip import set_tooltip_bg

    in CallTip.showtip():
    set_tooltip_bg(self.label)

    @panzi panzi mannequin added topic-IDLE type-bug An unexpected behavior, bug, or error labels Feb 17, 2010
    @panzi
    Copy link
    Mannequin Author

    panzi mannequin commented Feb 17, 2010

    I just noticed that the debugger also suffers from this problem. Doing a quick grep over the source reveals even more places that might cause problems (where only the bg or only the fg color is set).

    I think in ScrolledList.py the background="white" should just be removed. This and setting the fg color to black when the bg color is set to yellow (Debugger.py) makes the debugger usable.

    Checkboxes and radiobuttons seem to be messed up in general (forced white bg but using system fg color (white on white on my system); not IDLE's but Tkinter's or TK's fault).

    @panzi
    Copy link
    Mannequin Author

    panzi mannequin commented Feb 19, 2010

    I just found out the right method to parse a color in tk, so I removed my parse_color(color) function.

    @panzi
    Copy link
    Mannequin Author

    panzi mannequin commented Feb 19, 2010

    Sorry, I uploaded the wrong archive.

    In ToolTip.py I removed my parse_color(color) function, in Debugger.py I set the fg color to black when the bg color is set to yellow and in ScrolledList.py I removed brackground="white".

    @panzi
    Copy link
    Mannequin Author

    panzi mannequin commented Feb 19, 2010

    I need more sleep. I seem to have forgotten to attach the file

    @serwy
    Copy link
    Mannequin

    serwy mannequin commented Jan 17, 2013

    Updated the issue to reflect information from 16984. A screenshot was provided in that report.

    @serwy serwy mannequin changed the title idle does not handle dark gtk color schemes IDLE: problems with dark GTK or KDE color schemes Jan 17, 2013
    @terryjreedy
    Copy link
    Member

    bpo-16984 is closed as a duplicate of this. The screenshot helps. I was just thinking about adding a retro-black color theme to match the current old-is-new fashion. It appears that this would solve the Text part of the problem but Mathias' patch summary shows that more is needed to get other widgets in line.

    It appears that a review and written summary of colors in Idle would be helpful. I am curious what effect switching to themed widgets would have on this issue.

    @terryjreedy
    Copy link
    Member

    Problem as I understand it: various tk widgets and Idle popups and dialogs mix, for instance, a hard-coded background (white) with a sometimes incompatible (no or low contrast) system-default foreground, which is also white when the system background is black. Hence the sad screenshot for bpo-16984: https://bugs.python.org/file28755/snapshot-idle.png.

    Some of this may be tk's fault for not anticipating reversed graphics screen, some may be Idle's (I doubt tkinter gets involved). In any case, a solution is for Idle to set the colors for *every* widget it creates. The colors could be fixed in particular cases, but we could instead use one of the currently 13 user settings*. bpo-24820 is about adding a light on dark theme to Idle. When we start using ttk widgets (within a month), I believe this will be possible by setting an explicit default color pair for each class.

    • I am thinking I might try using the new dark theme on my white-background system, but I cannot know that I would want all the dialogs to use it. We might want to allow separate tagged text themes (what the current highlights are for) and widget themes. This will take some experimentation.

    @terryjreedy terryjreedy self-assigned this Sep 25, 2015
    @terryjreedy
    Copy link
    Member

    Use of ttk got delayed for back-compatibility issues. We should be clear to start in a week.

    @terryjreedy
    Copy link
    Member

    The IDLE Dark theme has been added and I use it routinely. Ttk widgets, including frames, are AFAIK used everywhere possible. We are not yet using ttk styles to configurable colors, but I would expect that the default style should always be viewable. My speculation is that this should prevent white-on-white or black-on-black.

    Mathias and Sureyya, do you see today the unusable combinations you say 10 and 7 years ago?

    Cheryl, are any of the issues described above possible on Ubuntu (today)?

    @terryjreedy terryjreedy added the 3.10 only security fixes label Jun 6, 2020
    @terryjreedy terryjreedy changed the title IDLE: problems with dark GTK or KDE color schemes IDLE: avoid no-contrast popups and dialogs. Jun 6, 2020
    @csabella
    Copy link
    Contributor

    csabella commented Jun 9, 2020

    I believe this was fixed with #80357.

    @terryjreedy
    Copy link
    Member

    terryjreedy commented Jun 9, 2020

    Thanks for finding that. Technically, #80357 should have been closed as a duplicate of this issue. But a fix anywhere is OK. Any other contrast problems should be a new issue.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @terryjreedy terryjreedy changed the title IDLE: avoid no-contrast popups and dialogs. IDLE colors: avoid no-contrast popups and dialogs. Oct 19, 2023
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants