Lyra Orwell
Lyra Orwell

Reputation: 1276

_tkinter.TclError: Layout PViewStyle not found

I am having trouble defining a Style for my Treeview widget.

newT=ttk.Style() 
newT.configure('PViewStyle', rowheight=100) 
PatrolView = ttk.Treeview(PatrolOverview,style='PViewStyle') 

but this yields

_tkinter.TclError: Layout PViewStyle not found

Upvotes: 2

Views: 1458

Answers (1)

Евгений Па
Евгений Па

Reputation: 76

I get same error :). The problem is that name style must be end to correct name style in tkinter

Widget class Style name
Button TButton
Checkbutton TCheckbutton
Combobox TCombobox
Entry TEntry
...
Treeview Treeview (not TTreview!)
https://anzeljg.github.io/rin2/book2/2405/docs/tkinter/ttk-style-layer.html

In your case you need to name your style as PViewStyle.Treeview

Change our code to:

newT=ttk.Style() 
newT.configure('PViewStyle.Treeview', rowheight=100) 
PatrolView = ttk.Treeview(PatrolOverview,style='PViewStyle.Treeview') 

Upvotes: 1

Related Questions