Search code examples
pythonpython-3.xtkinterthemesttk

How do I change a Tkinter theme globally?


I am programming a Tkinter program that shows details off of a website without downloading the website (i add the info manually).

But in my opinion, Tkinter on Linux looks like Windows 95, so I decided to change to clam theme so the buttons and other stuff looks nicer.

Here is my code:

from tkinter import ttk
s = ttk.Style()
s.theme_use('clam')

It works in the main window and tkinter.messagebox windows, but in Toplevel() windows, the theme isn't applied.

Does anyone know how to globally change the theme (including in Toplevel() windows)? Thanks :)


Solution

  • Using a TTK theme requires using TTK's widgets, not Tkinter's. Thank you @j_4321 for pointing this out!