classification
Title: Fix IDLE Autocomplete / Calltip Window Colors
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: cheryl.sabella, greylaw89, miss-islington, terry.reedy
Priority: normal Keywords: patch

Created on 2019-03-04 03:17 by greylaw89, last changed 2019-03-11 02:23 by terry.reedy. This issue is now closed.

Files
File name Uploaded Description Edit
kdedarktheme.png cheryl.sabella, 2019-03-09 14:13
searchdialogdark.png cheryl.sabella, 2019-03-09 14:14
Pull Requests
URL Status Linked Edit
PR 12262 merged terry.reedy, 2019-03-10 05:15
PR 12269 merged miss-islington, 2019-03-11 00:18
Messages (8)
msg337065 - (view) Author: Kristoffer Law (greylaw89) Date: 2019-03-04 03:17
IDLE utilizes the foreground text color from KDE/Qt (Window Text) for the autocomplete and calltip windows. If a dark theme is selected and the window text changed to white or another bright color, it can be difficult or impossible to see due to lack of contrast. There does not appear to be any way to change these particular windows text or background color settings from IDLE's configuration.

Modifying the variables under line 192 in autocomplete_w.py (bg="white") and line 83 in calltip_w.py (background="#ffffe0") allows these windows to change background colors.

Perhaps add these as settings in IDLE's config? Or force the foreground color to always be black?

Python 3.7.2
GCC 8.2.1

KDE Plasma Version: 5.15.2
KDE Frameworks Version: 5.55.0
Qt Version: 5.12.1

(This is my first bug submission ever, so if I missed something obvious, I apologize in advance)
msg337541 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-08 22:12
The only thing missing is the OS, which I presume is some version and distribution of Linux.

IDLE used tkinter which uses tcl/tk.  From what you say, the latter, at least on Linux, picks up its default colors from the window manager, which for you happens to be KDE.  (This seems not true, at least not yet, on current macOS, as switching to the new dark theme has no effect on IDLE.)  This suggests that when a widget has both foreground and background settings, IDLE should leave both alone to use compatible defaults or set both.

Except for text windows (which have both fore- and back-grounds) and frames and canvases (which only have background), IDLE generally does not set colors.  I just verified this for the settings and search dialogs.  Do these switch to light on dark when you set you screen to the same?

Setting autocomplete bg to white is an anomaly from before 2005.  It is useless or wrong and I think we should just delete the setting.

Setting the calltip and tooltips backgrounds (tooltip.py, line 162) to yellow is intentional, to contrast with the text.  So we should also set the foregrounds (to black).  I don't think these need to be configurable.

Cheryl, does your Ubuntu desktop have a dark theme option?  If so, does it affect tk defaults and hence IDLE?
msg337542 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-08 22:13
Kristoffer, can you try removing 'bg=while' from autocomplete_w.py?
msg337571 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2019-03-09 14:13
I didn't see an issue with a Gnome, so I installed KDE Plasma and switched to the dark theme.  I was able to recreate the issue for autocomplete.  When I tried 'open file', I also saw it there and I've attached a screen print showing how it looks on 'open file'.

Removing the 'bg=white' in autocomplete_w.py fixes the issue by changing  it to a gray background with the almost white text.  Of course that doesn't affect the 'open file' window.

I've also attached a screen print of what the search dialog looks like.
msg337596 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-10 04:35
I presume that the folders have names I cannot see because they are white on white, even though the current directly name is black (on gray).  The effect of the dark screen theme seems inconsistent.

  The open and save-as dialog boxes are provided by tk to either use or match the OS version.  (On Windows, I am fairly sure the native widget is being used.)  The tkinter wrappers are in its filedialog module. There are no color options.  So this is a tkinter or more likely, tk, issue.  This suggests to me that tcl/tk and KDE are not quite compatible.

The search box (searchbase.py) uses ttk widgets.  It seems that ttk.Frame picks up its background color from the environment while the included ttk widgets do not.  The effect is a little strange, but at least the text, including the entered text is readable.  We could make the backgrounds consistent either by setting the frame 'white' or by conditionally using a dark theme (there might already be one) for the contained widgets.  This is a separate issue.  

The 3.7.3rc cutoff is in a couple of days so I will make a minimal PR to fix the overt bugs that we know about and can.
msg337597 - (view) Author: Kristoffer Law (greylaw89) Date: 2019-03-10 04:38
Awesome, thanks.

Let me know if there is anything you'd like me to test, it looks like
you've already tested removing that variable.

On Sat, Mar 9, 2019, 20:35 Terry J. Reedy <report@bugs.python.org> wrote:

>
> Terry J. Reedy <tjreedy@udel.edu> added the comment:
>
> I presume that the folders have names I cannot see because they are white
> on white, even though the current directly name is black (on gray).  The
> effect of the dark screen theme seems inconsistent.
>
>   The open and save-as dialog boxes are provided by tk to either use or
> match the OS version.  (On Windows, I am fairly sure the native widget is
> being used.)  The tkinter wrappers are in its filedialog module. There are
> no color options.  So this is a tkinter or more likely, tk, issue.  This
> suggests to me that tcl/tk and KDE are not quite compatible.
>
> The search box (searchbase.py) uses ttk widgets.  It seems that ttk.Frame
> picks up its background color from the environment while the included ttk
> widgets do not.  The effect is a little strange, but at least the text,
> including the entered text is readable.  We could make the backgrounds
> consistent either by setting the frame 'white' or by conditionally using a
> dark theme (there might already be one) for the contained widgets.  This is
> a separate issue.
>
> The 3.7.3rc cutoff is in a couple of days so I will make a minimal PR to
> fix the overt bugs that we know about and can.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue36176>
> _______________________________________
>
msg337640 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-03-11 00:18
New changeset 491ef53c1548c2b593d3c35d1e7bf25ccb443019 by Terry Jan Reedy in branch 'master':
bpo-36176: Fix IDLE autocomplete & calltip popup colors. (#12262)
https://github.com/python/cpython/commit/491ef53c1548c2b593d3c35d1e7bf25ccb443019
msg337641 - (view) Author: miss-islington (miss-islington) Date: 2019-03-11 00:37
New changeset ea1627008e2ccca3eefa8f4f8123ad74d34c7500 by Miss Islington (bot) in branch '3.7':
bpo-36176: Fix IDLE autocomplete & calltip popup colors. (GH-12262)
https://github.com/python/cpython/commit/ea1627008e2ccca3eefa8f4f8123ad74d34c7500
History
Date User Action Args
2019-03-11 02:23:20terry.reedysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-03-11 00:37:39miss-islingtonsetnosy: + miss-islington
messages: + msg337641
2019-03-11 00:18:54miss-islingtonsetpull_requests: + pull_request12253
2019-03-11 00:18:42terry.reedysetmessages: + msg337640
2019-03-10 05:15:26terry.reedysetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request12247
2019-03-10 04:38:13greylaw89setmessages: + msg337597
2019-03-10 04:35:32terry.reedysetmessages: + msg337596
2019-03-09 14:14:29cheryl.sabellasetfiles: + searchdialogdark.png
2019-03-09 14:13:45cheryl.sabellasetfiles: + kdedarktheme.png

messages: + msg337571
2019-03-08 22:13:48terry.reedysetmessages: + msg337542
2019-03-08 22:12:52terry.reedysettype: enhancement -> behavior
stage: needs patch
2019-03-08 22:12:27terry.reedysetnosy: + cheryl.sabella
title: Make IDLE Autocomplete / Calltip Window Colors Configurable -> Fix IDLE Autocomplete / Calltip Window Colors
messages: + msg337541

versions: + Python 3.8
2019-03-04 03:17:11greylaw89create