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

Using sv_ttk causes crashes and visual bugs when using chlorophyll and switching between light and dark mode #54

Open
David-Vermaak opened this issue Aug 28, 2024 · 0 comments

Comments

@David-Vermaak
Copy link

David-Vermaak commented Aug 28, 2024

When there is a CodeView widget open and you switch from light mode to dark mode the application would crash

The first error I got was:

\chlorophyll\codeview.py", line 188, in _cmd_proxy
result = self.tk.call(self._orig, command, *args) _tkinter.TclError: unknown option "-activeforeground"

After messing around with the _cmd_proxy function:

def _cmd_proxy(self, command: str, *args) -> Any:
        try:
            if command in {"insert", "delete", "replace"}:
                start_line = int(str(self.tk.call(self._orig, "index", args[0])).split(".")[0])
                end_line = start_line
                if len(args) == 3:
                    end_line = int(str(self.tk.call(self._orig, "index", args[1])).split(".")[0]) - 1
            result = self.tk.call(self._orig, command, *args)
        except TclError as e:
            error = str(e)
            if 'tagged with "sel"' in error or "nothing to" in error:
                return ""
            # added this to catch the unknown option errors
            if "unknown option" in error:
                print(f"Ignoring unknown option: {error}")
                return ""
          # removed error return as it caused the crash 

Now I get this error in the console:

Ignoring unknown option: unknown option "-troughcolor"
Ignoring unknown option: unknown option "-activebackground"
Ignoring unknown option: unknown option "-disabledforeground"
Ignoring unknown option: unknown option "-activeforeground"

I did get it to not crash, but, it does cause weird visual artifacts.

Like this:

image

It should look like this:

image

@David-Vermaak David-Vermaak changed the title Using sv_ttk causes weird visual bugs when using chlorophyll and switching between light and dark mode Using sv_ttk causes crashes and weird visual bugs when using chlorophyll and switching between light and dark mode Aug 29, 2024
@David-Vermaak David-Vermaak changed the title Using sv_ttk causes crashes and weird visual bugs when using chlorophyll and switching between light and dark mode Using sv_ttk causes crashes and visual bugs when using chlorophyll and switching between light and dark mode Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant