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

Fix IDLE Autocomplete / Calltip Window Colors #80357

Closed
greylaw89 mannequin opened this issue Mar 4, 2019 · 8 comments
Closed

Fix IDLE Autocomplete / Calltip Window Colors #80357

greylaw89 mannequin opened this issue Mar 4, 2019 · 8 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@greylaw89
Copy link
Mannequin

greylaw89 mannequin commented Mar 4, 2019

BPO 36176
Nosy @terryjreedy, @csabella, @miss-islington
PRs
  • bpo-36176: Fix IDLE autocomplete & calltip popup colors. #12262
  • [3.7] bpo-36176: Fix IDLE autocomplete & calltip popup colors. (GH-12262) #12269
  • Files
  • kdedarktheme.png
  • searchdialogdark.png
  • 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 2019-03-11.02:23:20.528>
    created_at = <Date 2019-03-04.03:17:11.780>
    labels = ['3.8', 'expert-IDLE', 'type-bug', '3.7']
    title = 'Fix IDLE Autocomplete / Calltip Window Colors'
    updated_at = <Date 2019-03-11.02:23:20.528>
    user = 'https://bugs.python.org/greylaw89'

    bugs.python.org fields:

    activity = <Date 2019-03-11.02:23:20.528>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2019-03-11.02:23:20.528>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2019-03-04.03:17:11.780>
    creator = 'greylaw89'
    dependencies = []
    files = ['48200', '48201']
    hgrepos = []
    issue_num = 36176
    keywords = ['patch']
    message_count = 8.0
    messages = ['337065', '337541', '337542', '337571', '337596', '337597', '337640', '337641']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'cheryl.sabella', 'miss-islington', 'greylaw89']
    pr_nums = ['12262', '12269']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36176'
    versions = ['Python 3.7', 'Python 3.8']

    @greylaw89
    Copy link
    Mannequin Author

    greylaw89 mannequin commented Mar 4, 2019

    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)

    @greylaw89 greylaw89 mannequin added type-feature A feature request or enhancement 3.7 (EOL) end of life labels Mar 4, 2019
    @greylaw89 greylaw89 mannequin assigned terryjreedy Mar 4, 2019
    @greylaw89 greylaw89 mannequin added the topic-IDLE label Mar 4, 2019
    @terryjreedy
    Copy link
    Member

    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?

    @terryjreedy terryjreedy added the 3.8 only security fixes label Mar 8, 2019
    @terryjreedy terryjreedy changed the title Make IDLE Autocomplete / Calltip Window Colors Configurable Fix IDLE Autocomplete / Calltip Window Colors Mar 8, 2019
    @terryjreedy terryjreedy added type-bug An unexpected behavior, bug, or error and removed type-feature A feature request or enhancement labels Mar 8, 2019
    @terryjreedy
    Copy link
    Member

    Kristoffer, can you try removing 'bg=while' from autocomplete_w.py?

    @csabella
    Copy link
    Contributor

    csabella commented Mar 9, 2019

    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.

    @terryjreedy
    Copy link
    Member

    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.

    @greylaw89
    Copy link
    Mannequin Author

    greylaw89 mannequin commented Mar 10, 2019

    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\>


    @terryjreedy
    Copy link
    Member

    New changeset 491ef53 by Terry Jan Reedy in branch 'master':
    bpo-36176: Fix IDLE autocomplete & calltip popup colors. (bpo-12262)
    491ef53

    @miss-islington
    Copy link
    Contributor

    New changeset ea16270 by Miss Islington (bot) in branch '3.7':
    bpo-36176: Fix IDLE autocomplete & calltip popup colors. (GH-12262)
    ea16270

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants