This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: IDLE: avoid no-contrast popups and dialogs.
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.10
Status: closed Resolution: duplicate
Dependencies: Superseder: Fix IDLE Autocomplete / Calltip Window Colors
View: 36176
Assigned To: terry.reedy Nosy List: cheryl.sabella, markroseman, panzi, roger.serwy, sahin, terry.reedy
Priority: normal Keywords:

Created on 2010-02-17 02:01 by panzi, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit panzi, 2010-02-17 02:01 patched version of, and panzi, 2010-02-19 16:17 patched version of,,, and
Messages (12)
msg99457 - (view) Author: Mathias Panzenböck (panzi) * Date: 2010-02-17 02:01
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/
added functions:

in ToolTipBase.showcontents():

in ListboxToolTip.showcontents():

in idlelib/
   from ToolTip import set_tooltip_bg

in AutoCompleteWindow.show_window():

in idlelib/
   from ToolTip import set_tooltip_bg

in CallTip.showtip():
msg99458 - (view) Author: Mathias Panzenböck (panzi) * Date: 2010-02-17 02:30
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 the background="white" should just be removed. This and setting the fg color to black when the bg color is set to yellow ( 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 idles but Tkinters or TKs fault).
msg99578 - (view) Author: Mathias Panzenböck (panzi) * Date: 2010-02-19 16:13
I just found out the right method to parse a color in tk, so I removed my parse_color(color) function.
msg99579 - (view) Author: Mathias Panzenböck (panzi) * Date: 2010-02-19 16:16
Sorry, I uploaded the wrong archive.

In I removed my parse_color(color) function, in I set the fg color to black when the bg color is set to yellow and in I removed brackground="white".
msg99580 - (view) Author: Mathias Panzenböck (panzi) * Date: 2010-02-19 16:17
I need more sleep. I seem to have forgotten to attach the file
msg180120 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-01-17 06:48
Updated the issue to reflect information from 16984. A screenshot was provided in that report.
msg231203 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-11-15 05:53
#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.
msg251562 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-09-25 01:58
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 #16984:

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*.  #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.
msg267582 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-06-07 01:56
Use of ttk got delayed for back-compatibility issues.  We should be clear to start in a week.
msg370842 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-06-06 17:37
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)?
msg371100 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2020-06-09 12:43
I believe this was fixed with #36176.
msg371104 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-06-09 13:22
Thanks for finding that.  Technically, #36176 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.
Date User Action Args
2022-04-11 14:56:57adminsetgithub: 52197
2020-06-09 13:22:11terry.reedysetstatus: open -> closed
superseder: Fix IDLE Autocomplete / Calltip Window Colors
messages: + msg371104

resolution: duplicate
stage: needs patch -> resolved
2020-06-09 12:43:48cheryl.sabellasetmessages: + msg371100
2020-06-06 17:37:07terry.reedysetnosy: + cheryl.sabella
title: IDLE: problems with dark GTK or KDE color schemes -> IDLE: avoid no-contrast popups and dialogs.
messages: + msg370842

versions: + Python 3.10, - Python 3.6
2016-06-07 01:56:28terry.reedysetmessages: + msg267582
versions: - Python 2.7, Python 3.4, Python 3.5
2015-09-25 01:58:46terry.reedysetversions: + Python 3.6
nosy: + markroseman

messages: + msg251562

assignee: terry.reedy
stage: needs patch
2014-11-15 05:53:26terry.reedysetnosy: + terry.reedy
messages: + msg231203
2014-07-27 22:45:42terry.reedysetversions: + Python 3.5, - Python 3.1, Python 3.2, Python 3.3
2013-01-17 06:48:29roger.serwysetnosy: + roger.serwy, sahin
title: idle does not handle dark gtk color schemes -> IDLE: problems with dark GTK or KDE color schemes
messages: + msg180120

versions: + Python 3.1, Python 2.7, Python 3.2, Python 3.3, Python 3.4, - Python 2.6
2013-01-17 06:46:34roger.serwylinkissue16984 superseder
2010-02-19 16:17:35panzisetfiles: +

messages: + msg99580
2010-02-19 16:16:46panzisetmessages: + msg99579
2010-02-19 16:14:16panzisetfiles: -
2010-02-19 16:13:36panzisetfiles: +

messages: + msg99578
2010-02-17 02:30:46panzisetmessages: + msg99458
2010-02-17 02:01:51panzicreate