> I would be obliged if someone could point me to a document that clearly
> explains the hierarchy of objects and properties inside ttk, how
> layouts, styles, themes, elements and options are organised, interact
> and generally, how the whole ttk widget set works and what tools (i.e.
> Tcl commands) are available to actually explore the object hierarchy.
>
Hi,
There is really an unfinished documentation concerning ttk::widget, it's true, and looks like handcraft than coding !
If you think an element exist try a command that seems logical until it gives something, for instance :
ttk::style element options TLabelframe.label
will return :
-compound -space -text -font -foreground -underline -width -anchor -justify -wraplength -embossed -image -stipple -background
The clearest and most complete documentation I know is on this page :
http://www.tkdocs.com/tutorial/styles.html
So, I've created some small scripts that can give me information for ttk::widget. The difficulty is that unexisting possibilities don't return error, for instance :
ttk::style element options Labelframe.border --> returns "" ( but no error )
ttk::style element options TLabelframe.border --> return "-relief"
on the other hand :
ttk::style element options TLabelframe.label
and
ttk::style element options Labelframe.label
return the same thing !
Using brute force, I simply try each possibility given by "element names" "layout" or "element options".
As an exemple, here is an ugly example for labelframes :-/ :
#------------------------------------------------------
et output [open get_themed_labelframe.txt w]
ttk::style theme use xpnative
# ttk::style theme use winnative
# ttk::style theme use alt
# ttk::style theme use aqua
# ttk::style theme use clam
# ttk::style theme use classic
# ttk::style theme use vista
font create TkfabLabelFrameFont {*}[font configure TkDefaultFont] -weight normal -size 8
#font configure TkfabLabelFrameFont -weight normal -size 8
puts $output "font configure TkfabLabelFrameFont"
puts $output "[font configure TkfabLabelFrameFont]"
puts $output "\n"
puts $output "ttk::style theme names"
puts $output "[ttk::style theme names]"
puts $output "\n"
puts $output "ttk::style theme use"
puts $output "[ttk::style theme use]"
puts $output "\n"
puts $output "ttk::style element names"
puts $output "[ttk::style element names]"
puts $output "\n \n"
# Create a dialog to demonstrate the new entry widget style
set dlg [toplevel .test_labelframe ]
wm title $dlg "ttk::labelframe test"
ttk::labelframe $dlg.lf -text test
set usedStyle_ifnotdefault [$dlg.lf cget -style]
set usedStyle [winfo class $dlg.lf]
puts $output "usedStyle of $dlg.lf : $usedStyle"
puts $output "usedStyle_ifnotdefault of $dlg.lf : $usedStyle_ifnotdefault"
puts $output "\n"
puts $output "LAYOUT LAYOUT LAYOUT"
puts $output "ttk::style layout TLabelframe"
puts $output "[ttk::style layout TLabelframe]"
puts $output "\n "
puts $output "OPTIONS OPTIONS OPTIONS"
puts $output "ttk::style element options Labelframe.label"
puts $output "[ttk::style element options Labelframe.label]"
puts $output "ttk::style element options TLabelframe.label"
puts $output [ttk::style element options TLabelframe.label]
puts $output "\n "
puts $output "ttk::style element options Labelframe.border"
puts $output "[ttk::style element options Labelframe.border]"
puts $output "ttk::style element options TLabelframe.border"
puts $output [ttk::style element options TLabelframe.border]
puts $output "\n "
puts $output "LOOKUP LOOKUP LOOKUP"
puts $output "ttk::style lookup TLabelframe.border -relief"
puts $output "[ttk::style lookup TLabelframe.border -relief]"
puts $output "ttk::style lookup TTLabelframe.border -relief"
puts $output "[ttk::style lookup TTLabelframe.border -relief]"
puts $output "\n "
puts $output "ttk::style lookup TLabelframe.label -relief"
puts $output "[ttk::style lookup TLabelframe.label -relief]"
puts $output "ttk::style lookup TTLabelframe.label -relief"
puts $output "[ttk::style lookup TTLabelframe.label -relief]"
puts $output "\n "
puts $output "ttk::style lookup TLabelframe.Label -relief"
puts $output "[ttk::style lookup TLabelframe.Label -relief]"
puts $output "ttk::style lookup TTLabelframe.Label -relief"
puts $output "[ttk::style lookup TTLabelframe.Label -relief]"
puts $output "\n "
close $output
#wm withdraw .
#tkwait window $dlg
exit
------------------------------------------
Olivier