Search code examples
tkinterpyinstallerttkbootstrap

ttkbootstrap not working with pyinstaller


With Python Interpreter it works fine, image loads and main.py runs without problems, but when I make it into one file .exe with Pyinstaller, .exe crashes with the following error message.

FileNotFoundError: 'themes.json' resource not found in 'ttkboostrap'

Any help would be sincerely appreciated.


Solution

  • Had the same issue.

    Head over to where your ttkbootstrap is installed, copy themes.json and Symbola.ttf (if required) to the same folder as your main.py and main.spec.

    Then modify your main.spec with datas=[('themes.json', 'ttkbootstrap'), ('Symbola.ttf', 'ttkbootstrap')] under a = Analysis().

    Symbola.ttf may not be required for you but I encountered another FileNotFoundError after copying themes.json over to the folder, which required me to bring over Symbola.ttf as well.

    Once done, run pyinstaller main.spec on elevated command prompt.