Closed Dhierin closed 3 years ago
For my Azure and Sun Valley themes I implemented an easy way to switch between themes, without any problem.
You get the error, because the theme is already exists, and it cannot be created again. Below you can find the solution on how to change the theme with this theme, but unfortunately some colors won't change. In the future, I'll create a method for this topic to switch themes without any problems, but I won’t deal with that yet.
themename='forest-dark'
root.tk.call('source', "forest-light.tcl")
root.tk.call('source', "forest-dark.tcl")
ttk.Style().theme_use(themename)
def change_theme():
global themename
if themename == 'forest-dark':
themename = 'forest-light'
ttk.Style().theme_use(themename)
print(themename)
elif themename=='forest-light':
themename = 'forest-dark'
ttk.Style().theme_use(themename)
Hi, first of all, I'd like to thank you for the nice theme. I like it a lot, I am currently trying to make a button to switch from one theme to the other. I have my default set at the dark forest theme. Using the code attached I am trying to change the themes. I am able to change from dark to light mode. However, when trying to change from light back to dark, I get the following error: in change_theme root.tk.call('source', tclfile) _tkinter.TclError: Theme forest-dark already exists. What am I missing?