Python Forum

Full Version: Theme does not change globally
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was trying to use a Tkinter theme in Python 3.x.

Here is my code:
s = ttk.Style()
s.theme_use('clam')
But in
Toplevel()
windows, the theme disappears.

Does anyone know how to do a theme for all windows ? Thanks! :)
I figured it out:

I had to write this
from tkinter.ttk import *
to override all widgets to TTK widgets because the default widgets don't support theming...
I had been using a TTK Notebook and therefore in my main window it was working, but not elsewhere.
I hope this helps someone.
In the future use:
import tkinter as tk
import tkinter.ttk as ttk
Then there will be no confusion about which widgets are tk and which widgets are themed tk. As you write more complex programs that use more packages, using "from package import *" is eventually going to lead to a namespace collision. You will think you are calling a function from one package and instead you are calling a different function from a different package. That sort of bug is really difficult to trace.