Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solving "TclError: Layout TLabelFrame not found" [closed]

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...

like image 649
Gobhniu Avatar asked Nov 17 '16 01:11

Gobhniu


1 Answers

Use Black.TLabelframe with lower f

like image 73
furas Avatar answered Oct 19 '22 03:10

furas