Gobhniu Gobhniu - 2 months ago 12
Python Question

Apply a style with ttk?

So I am trying to apply a simple style to a labelframe widget with the following code:

import sys
if sys.version_info[0] == 2: # Just checking your Python version to import Tkinter properly.
import Tkinter as tk
import ttk as ttk
import tkinter as tk
from tkinter.ttk import ttk as ttk

root = tk.Tk()
bls = ttk.Style()
bls.configure('Black.TLabelFrame', background="#222222")

dayframe = ttk.Labelframe(root, style='Black.TLabelFrame', height=200, width=150, relief=tk.SUNKEN,
dayframe.grid(row=1, column=1, padx=5)

But when I run this code I get the error message: TclError: Layout Black.TLabelFrame not found

I don't understand what I am doing wrong...


Use Black.TLabelframe with lower f