TomSchimansky / TomSchimansky/CustomTkinter

Upgrading to CustomTkinter 5.0.1 breaks my app (KeyError: 'CTk')

Open
#764 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

information
Dominant language
Python
Stars
13.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Hi. I just upgraded to CustomTkinter 5.0.1, and now when I launch my app, I get a dictionary lookup error:

The stack trace tells me that it's the last line of these:

...
import tkinter as tk
from tkinter import filedialog as fd
import customtkinter as ctk
...

class DCCMView(ctk.CTk):
    """Class to act as our visual interface."""

    def __init__(self, mvc_controller, *args, **kwargs):
        super().__init__(*args, **kwargs)                                         <<< Line 1705

This is the error stack:

  File "D:\Development\PycharmProjects\dccm\dccm.py", line 2535, in <module>
    controller = DCCMControl(app_home, mode=run_mode, db_file_path=db_file, connection_identifier=connection_identifier)
  File "D:\Development\PycharmProjects\dccm\dccm.py", line 1246, in __init__
    self.mvc_view = DCCMView(mvc_controller=self)
  File "D:\Development\PycharmProjects\dccm\dccm.py", line 1705, in __init__
    super().__init__(*args, **kwargs)
  File "D:\Development\PycharmProjects\dccm\venv\lib\site-packages\customtkinter\windows\ctk_tk.py", line 51, in __init__
    self._fg_color = ThemeManager.theme["CTk"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
KeyError: 'CTk'

This also occurs on 5.0.0. Reverting back to 4.6.3 causes the app to work OK.

Regards,

Clive

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at customtkinter/windows/ctk_tk.py line 51, where DCCMView's ctk.CTk initialization raises the KeyError. Reproduce the failure with the shown DCCMView example under CustomTkinter 5.0.0 or 5.0.1, then compare behavior with 4.6.3. Done means the application starts without the 'CTk' lookup error after upgrading.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.