TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
11.55k stars 1.08k forks source link

CTkLabel / text_color_disabled: Fix for #1557 is incorrect #1837

Open avalon60 opened 1 year ago

avalon60 commented 1 year ago

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)
ghost commented 1 year ago

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

avalon60 commented 1 year ago

Not sure that Tom bothers with PRs.

avalon60 commented 9 months ago

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?

ghost commented 9 months ago

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.