Themes for Tkinter

Fareed Khan
3 min readSep 12, 2022

--

There exists a library in Python having the name ttkthemes, which contains a group of themes for Tkinter which are gathered by RedFantom and created by various authors.

This library helps developers to create a front-end of their desktop app using Tkinter without much code. In this guide, we will be exploring this library so you can understand how to use it in your projects.

Link to their repository: https://github.com/TkinterEP/ttkthemes

Link to their official documentation: https://ttkthemes.readthedocs.io/en/latest/

First, we need to install ttkthemes library using:

pip install ttkthemes

As stated in their official documentation:

The themes plastik, clearlooks, and elegance are recommended to make your UI look nicer on all platforms when using Tkinter and the ttk extensions in Python. When you are targeting Ubuntu, consider using the great radiance theme.

Let’s create a very basic Tkinter app:

ttk purpose is to style components of your Tkinter app, just like you style HTML with CSS. This is the reason I have imported ttk because all our theme customization lies in ttk.

Let’s change the theme of our app using the ThemedTk library that we installed earlier.

Importing our ThemedTk library along with other libraries.

Instead of creating a root window using Tkinter, we will be creating a root window using ThemedTk.

As you can see, I have passed a new theme i.e., winxpblue. A theme that tries to imitate the Windows XP look and feel was created by Pat Thoyts in 2004.

The rest of the code remains the same. Here is the complete code of my app after changing the theme.

This is the output:

You may think that this UI does not look a lot different from the previous one, but it is different.

The below-given image is available on their documentation page that gives you a good look at how Tkinter components look on the winxpblue theme.

Let’s import a new theme i.e., arc using:

It is one of the newest themes. Being created by Sergei Golovan in 2015.

This is the output of the arc theme:

One thing you must make sure is that each theme is not available on every operating system. You must look at their documentation to get a good understanding of each theme and its use case.

I do have a separate blog on how you can create a modern user interface for the Tkinter app without much code, here is the link to that blog:

https://medium.com/@fareedkhandev/modern-gui-using-tkinter-12da0b983e22

--

--