Search code examples
pythontkinterttk

How to apply ThemedTk themes to Notebook Frames?


Below is the code I have. The theme is not applied to any notebook tabs, as shown in the screenshot below. How to fix it?

from tkinter import *
from tkinter import ttk
from ttkthemes import ThemedTk


root = ThemedTk(theme="smog")
root.title("Lipid Analysis GUI")
#style = ThemedStyle(root)
#style.set_theme("breeze",themebg='black')
note = ttk.Notebook(root)
tab1 = Frame(note)
tab2 = Frame(note)
tab3 = Frame(note)
tab4 = Frame(note)
note.add(tab1, text = "Merge")
note.add(tab2, text = "TAG/Plot")
note.add(tab3, text = "Read mzml")
note.add(tab4, text = "PC/Plot")
note.pack()

screenshot


Solution

  • You're using the standard tk Frame widget which doesn't use the themes provided by ttktheme. If you want your tabs (or perhaps more accurately, the frames used to make the tabs) adhere to the theme, you need to use ttk.Frame rather than Frame.