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
else:
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,
text="Hello")
dayframe.grid(row=1, column=1, padx=5)
root.mainloop()
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With