rdbende / Sun-Valley-ttk-theme

A gorgeous theme for Tkinter/ttk, based on the Sun Valley visual style ✨
https://pypi.org/project/sv-ttk
MIT License
1.97k stars 112 forks source link

File not found #23

Closed Ethan-Ka closed 2 years ago

Ethan-Ka commented 2 years ago
couldn't read file "/theme/light.tcl": no such file or directory
  File "[C:\Users\kawle\Documents\VSC\installer\installer.py]()", line 33, in <module>
    window.tk.call('source', (dir_path+'/sun-valley.tcl'))```

code:

window = Tk()
style = ttk.Style(window)
window.tk.call('source', (dir_path+'/sun-valley.tcl'))
style.theme_use('sun-valley-light')
rdbende commented 2 years ago

Quite a strange issue, I haven't seen this before with this theme.

Could you ensure that the directory structure is like this?

dir_path (you mentioned in the code)
 |-> sun-valley.tcl
 |-> theme
     |-> light.tcl
     |-> dark.tcl
     |-> light
         |-> many png files
     |-> dark
         |-> many png files

Actually, I recommend you to try out the sv_ttk Python module instead: https://github.com/rdbende/Sun-Valley-ttk-theme/discussions/19 it's much easier to use the theme with it.

MrLucio commented 2 years ago

I might suggest replacing the directory separator from slash to backslash.

So in your case it would be:

# you should also change dir_path

window = Tk()
style = ttk.Style(window)
window.tk.call('source', (dir_path+'\sun-valley.tcl'))
style.theme_use('sun-valley-light')