CustomTkinter icon indicating copy to clipboard operation
CustomTkinter copied to clipboard

CTkLabel / text_color_disabled: Fix for #1557 is incorrect

Open avalon60 opened this issue 2 years ago • 4 comments

Hi @TomSchimansky.

Looking at the code for ctk_label.py, you appear to be checking to see whether someone has defined a "text_color_disabled" key in the theme JSON. However if you find it, you seem to ignore it and instead, set the text self._text_color_disabled to text_color, rather than the colour for the discovered key...

        if text_color_disabled is None:
            if "text_color_disabled" in ThemeManager.theme["CTkLabel"]:
                self._text_color_disabled = ThemeManager.theme["CTkLabel"]["text_color"]
            else:
                self._text_color_disabled = self._text_color
        else:
            self._text_color_disabled = self._check_color_type(text_color_disabled)

This however, does work:

        if text_color_disabled is None:
            if "text_color_disabled" in ThemeManager.theme["CTkLabel"]:
                self._text_color_disabled = ThemeManager.theme["CTkLabel"]["text_color_disabled"]
            else:
                self._text_color_disabled = self._text_color
        else:
            self._text_color_disabled = self._check_color_type(text_color_disabled)

avalon60 avatar Jul 22 '23 09:07 avalon60

Might as well make a PR since you have a working solution.

ghost avatar Jul 23 '23 23:07 ghost

Not sure that Tom bothers with PRs.

avalon60 avatar Jul 29 '23 00:07 avalon60

Hi @TomSchimansky.

Looking at the code for ctk_label.py, you appear to be checking to see whether someone has defined a "text_color_disabled" key in the theme JSON. However if you find it, you seem to ignore it and instead, set the text self._text_color_disabled to text_color, rather than the colour for the discovered key...

        if text_color_disabled is None:
            if "text_color_disabled" in ThemeManager.theme["CTkLabel"]:
                self._text_color_disabled = ThemeManager.theme["CTkLabel"]["text_color"]
            else:
                self._text_color_disabled = self._text_color
        else:
            self._text_color_disabled = self._check_color_type(text_color_disabled)

This however, does work:

        if text_color_disabled is None:
            if "text_color_disabled" in ThemeManager.theme["CTkLabel"]:
                self._text_color_disabled = ThemeManager.theme["CTkLabel"]["text_color_disabled"]
            else:
                self._text_color_disabled = self._text_color
        else:
            self._text_color_disabled = self._check_color_type(text_color_disabled)

@TomSchimansky is there likely to be a fix for this?

avalon60 avatar Feb 17 '24 21:02 avalon60

I was thinking about creating a fork of this repo for fixes and changes and stuff. However, I don't have time right now as I'm trying to learn new things + school.

ghost avatar Feb 18 '24 03:02 ghost