How do I change the overall theme of a tkinter application?

The ttk themed widget in Tkinter is introduced to design the external properties and styles of a widget in application. The ttk uses Tcl/Tk interpreter to give the user access to the interface that has many inbuilt attributes and features useful for any widget or application. Now, if we compare Ttk themes with Tcl themes, there are lots of variations in it.

Ttk generally supports only a few themes which are as follows −

  • winnative
  • clam
  • alt
  • default
  • classic
  • vista
  • xpnative

In order to change the overall theme of a tkinter application, we have to use the style.theme_use(theme_name) function.


# Import the required libraries in tkinter
from tkinter import *
from tkinter import ttk
from tkinter import messagebox

# Create an instance of tkinter frame or window
win = Tk()

# Set the size of tkinter window

# Create an instance of ttk Style
style = ttk.Style()

# Configure the theme with style

# Define a function to show the message
def display_msg():
   messagebox.showinfo("Message", "You are learning Python Tkinter!")

# Add a Customized Label widget
label = ttk.Label(win, text="Hey Folks, I have a Message for You!", font=('Aerial 16'))

# Add a Button widget
ttk.Button(win, text="Show Message", command=display_msg).place(x=285, y=98)



Running the above code will open a window with a label widget and a button. The overall theme of the application is defined by ttk themed widget. We can configure the theme from the list of available themes in tkinter library