Use ttk theme in pyinstaller's onefile mode and can't execute

414 Views Asked by At

As title, I used ttk in pyinstaller's onefile mode and can't execute because I include a a01.tcl file,and this file had the following codes:

source theme/a02.tcl
source theme/a03.tcl
proc set_theme {mode} {
    if {$mode == "a02"} {
        ttk::style theme use "dark"
...
...
    } elseif {$mode == "a03"} {
        ttk::style theme use "light"

and after I convert it to a executable file, It returns :

could't read file:"theme/a02.tcl" no such file or directory.

in the main code, it used

window.tk.call("set_theme", "a02")

to call the theme, so I can't use some code like base_path = sys._MEIPASS to handle it. It runs perfectly when I convert it to a directory, but it not effective in onefile mode.

0

There are 0 best solutions below