On Friday, August 31, 2018 at 3:53:32 PM UTC-7, Luis Alejandro Muzzachiodi wrote:
> How this must be saved in order to see running with the demo widget.tcl ?
That's an interesting question.
Unfortunately, it looks like much of the demo does not use ttk widgets.
And all of those toplevel frames are going to have the wrong background color
(since they are not ttk frames).
[This is rather out-of-date. The demo must not look very good on windows.]
I did:
bll-tecra:bll$ rlwrap tclsh
% source /home/bll/s/ballroomdj/code/themes/awdark.tcl
% ttk::style theme use awdark
% source widget
And some of the widgets do show up with the new theme, but not that many,
and it certainly doesn't present a clear picture of what the theme looks like.
Try the code below. If you are not on windows, the #! line will need to
be changed. If there's something more you want to see in this demo code, you
can change it, or let me know, and I can add it in. Just put the theme
name on the command line. I know it does not exercise all the possibilities,
and those do need to be added in before I can truly say the theme is ready.
#!/home/bll/local/bin/tclsh
package require Tk
if { [llength $::argv] != 1 } {
puts "Usage: dttk.tcl <theme>"
exit 1
}
set theme [lindex $::argv 0]
if { [file exists $theme.tcl] } {
source $theme.tcl
}
ttk::style theme use $theme
set tbg [ttk::style lookup TFrame -background]
lassign [winfo rgb . $tbg] bg_r bg_g bg_b
set tbg [format {#%02x%02x%02x} \
[expr {$bg_r / 256}] \
[expr {$bg_g / 256}] \
[expr {$bg_b / 256}]]
set val 55
set valb $theme
set off 0
set on 1
. configure -background $tbg
ttk::notebook .nb
pack .nb -side left -fill both -expand true
ttk::labelframe .lf -text " $theme "
.nb add .lf -text $theme
ttk::frame .two
.nb add .two -text [join [lreverse [split $theme {}]] {}]
ttk::frame .three
.nb add .three -text Another
ttk::frame .four
.nb add .four -text {Another Really Long Name}
ttk::frame .bf
ttk::label .lb -text $theme
ttk::button .b -text $theme
pack .lb .b -in .bf -side left -padx 3p
ttk::combobox .combo -values [list aaa bbb ccc] -textvariable valb -width 15
ttk::frame .cbf
ttk::checkbutton .cboff -text off -variable off
ttk::checkbutton .cboffd -text off -variable off -state disabled
ttk::checkbutton .cbon -text on -variable on
ttk::checkbutton .cbond -text on -variable on -state disabled
pack .cboff .cboffd .cbon .cbond -in .cbf -side left -padx 3p
ttk::separator .sep
ttk::frame .rbf
ttk::radiobutton .rboffd -text off -variable off -value 0 -state disabled
ttk::radiobutton .rbond -text on -variable off -value 1 -state disabled
pack .rboffd .rbond -in .rbf -side left -padx 3p
ttk::radiobutton .rboff -text off -variable on -value 0
ttk::radiobutton .rbon -text on -variable on -value 1
pack .rboff .rbon -in .rbf -side left -padx 3p
ttk::scale .sc -from 0 -to 100 -variable val
ttk::progressbar .pb -mode determinate -length 100 -variable val
ttk::entry .ent -textvariable valb -width 15
ttk::spinbox .sbox -textvariable val -width 5 \
-from 1 -to 100 -increment 0.1
ttk::scrollbar .sb
ttk::sizegrip .sg
pack .sb -side right -fill y -expand false
pack .bf .combo .cbf .sep .rbf .sc .pb .ent .sbox \
-in .lf -side top -anchor w -padx 3p -pady 3p
pack configure .sep -fill x -expand true
pack .sg -in .lf -side right -anchor s