Skip to content

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

Closed

Description

@panzi
mannequin
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']

    Activity

    1. panzi commented on Feb 17, 2010

      panzimannequin
      MannequinAuthor

      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)

    2. added
      type-bug
      on Feb 17, 2010
    3. panzi commented on Feb 17, 2010

      panzimannequin
      MannequinAuthor

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

    4. panzi commented on Feb 19, 2010

      panzimannequin
      MannequinAuthor

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

    5. panzi commented on Feb 19, 2010

      panzimannequin
      MannequinAuthor

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

    6. panzi commented on Feb 19, 2010

      panzimannequin
      MannequinAuthor

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

    7. serwy commented on Jan 17, 2013

      serwymannequin
      Mannequin

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

    8. changed the title [-]idle does not handle dark gtk color schemes[/-] [+]IDLE: problems with dark GTK or KDE color schemes[/+] on Jan 17, 2013
    9. terryjreedy commented on Nov 15, 2014

      @terryjreedy
      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.

    10. terryjreedy commented on Sep 25, 2015

      @terryjreedy
      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.
    11. self-assigned this
      on Sep 25, 2015
    12. terryjreedy commented on Jun 7, 2016

      @terryjreedy
      Member

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

    13. terryjreedy commented on Jun 6, 2020

      @terryjreedy
      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)?

    14. changed the title [-]IDLE: problems with dark GTK or KDE color schemes[/-] [+]IDLE: avoid no-contrast popups and dialogs.[/+] on Jun 6, 2020
    15. csabella commented on Jun 9, 2020

      @csabella
      Contributor

      I believe this was fixed with #80357.

    16. terryjreedy commented on Jun 9, 2020

      @terryjreedy
      Member

      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.

    17. transferred this issue fromon Apr 10, 2022
    18. changed the title [-]IDLE: avoid no-contrast popups and dialogs.[/-] [+]IDLE colors: avoid no-contrast popups and dialogs.[/+] on Oct 19, 2023
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    3.10 (EOL)topic-IDLEtype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions