Samuel Crawford
Samuel Crawford

Reputation: 41

how to include ttk themes in nuitka compilation of python file

I have a python file that uses tkinter. I have added the ttk Azure theme to make it look better. However I am not sure how to include this in the nuitka command to compile my program into a standalone app. In my python file, I import it with this:

self.root.tk.call("source", "azure.tcl")
self.root.tk.call("set_theme", "dark")

Because of this I tried to use the --include-data-files command to include it in my nuitka compilation.

Currently the command I use is:

python -m nuitka --enable-plugin=tk-inter --include-data-files=Logo.png=Logo.png --include-data-files=Icon.ico=Icon.ico --include-data-files=azure.tcl=azure.tcl --standalone main.py

The issue it throws is when i run the main.exe file is:

Traceback (most recent call last):
    File "C:\Users\samue\OneDrive\Desktop\EVOLUT~1\MAIN~1.DIS\main.py" line 136, in <module>
    File "C:\Users\samue\OneDrive\Desktop\EVOLUT~1\MAIN~1.DIS\main.py" line 29, in __init__
_tkinter.TclError: couldn't read file "./theme/light.tcl": no such file or directory

I think the issue may be that I need to include the whole folder that contains the file: Azure-ttk-theme-main, but I'm not sure how to do that.

Also could anyone let me know how to change my command to create a single file .exe?

Upvotes: 0

Views: 616

Answers (1)

Timothy Hobbs
Timothy Hobbs

Reputation: 13

The command that worked for me was the following, the documentation is a bit confusing.

--include-data-files=azure.tcl=azure.tcl --include-data-dir=theme=theme

Upvotes: 0

Related Questions