summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authordas <das>2008-03-11 22:30:17 (GMT)
committerdas <das>2008-03-11 22:30:17 (GMT)
commit6228db02586f2e758bbc83e85755c6176cf007a4 (patch)
treebf08f29c89890c66018d502f895cf74b400e119b /library
parent190dfe1c0664f5c9d0da53420f343bf53d40eb8e (diff)
downloadtk-6228db02586f2e758bbc83e85755c6176cf007a4.zip
tk-6228db02586f2e758bbc83e85755c6176cf007a4.tar.gz
tk-6228db02586f2e758bbc83e85755c6176cf007a4.tar.bz2
* library/demos/knightstour.tcl: Aqua GOOBE.
* library/demos/widget:
Diffstat (limited to 'library')
-rw-r--r--library/demos/knightstour.tcl38
-rw-r--r--library/demos/widget3
2 files changed, 26 insertions, 15 deletions
diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl
index 93f8b47..95ee6ca 100644
--- a/library/demos/knightstour.tcl
+++ b/library/demos/knightstour.tcl
@@ -98,7 +98,7 @@ proc MovePiece {dlg last square} {
if {$next ne -1} {
variable aid [after $delay [list MovePiece $dlg $square $next]]
} else {
- $dlg.b1 configure -state normal
+ $dlg.tf.b1 configure -state normal
if {[llength $visited] == 64} {
variable initial
if {$initial == $square} {
@@ -120,7 +120,7 @@ proc MovePiece {dlg last square} {
proc Tour {dlg {square {}}} {
variable visited {}
$dlg.f.txt delete 1.0 end
- $dlg.b1 configure -state disabled
+ $dlg.tf.b1 configure -state disabled
for {set n 0} {$n < 64} {incr n} {
$dlg.f.c itemconfigure $n -state disabled -outline black
}
@@ -179,13 +179,14 @@ proc CreateGUI {} {
variable delay 600
variable continuous 0
- ttk::label $dlg.ls -text Speed
- ttk::scale $dlg.sc -from 8 -to 2000 -command [list SetDelay] \
+ ttk::frame $dlg.tf
+ ttk::label $dlg.tf.ls -text Speed
+ ttk::scale $dlg.tf.sc -from 8 -to 2000 -command [list SetDelay] \
-variable [namespace which -variable delay]
- ttk::checkbutton $dlg.cc -text Repeat \
+ ttk::checkbutton $dlg.tf.cc -text Repeat \
-variable [namespace which -variable continuous]
- ttk::button $dlg.b1 -text Start -command [list Tour $dlg]
- ttk::button $dlg.b2 -text Exit -command [list Exit $dlg]
+ ttk::button $dlg.tf.b1 -text Start -command [list Tour $dlg]
+ ttk::button $dlg.tf.b2 -text Exit -command [list Exit $dlg]
set square 0
for {set row 7} {$row != -1} {incr row -1} {
for {set col 0} {$col < 8} {incr col} {
@@ -194,8 +195,8 @@ proc CreateGUI {} {
} else {
set fill bisque ; set dfill bisque3
}
- set coords [list [expr {$col * 30 + 3}] [expr {$row * 30 + 3}] \
- [expr {$col * 30 + 29}] [expr {$row * 30 + 29}]]
+ set coords [list [expr {$col * 30 + 4}] [expr {$row * 30 + 4}] \
+ [expr {$col * 30 + 30}] [expr {$row * 30 + 30}]]
$c create rectangle $coords -fill $fill -disabledfill $dfill \
-width 2 -state disabled
}
@@ -213,11 +214,20 @@ proc CreateGUI {} {
grid columnconfigure $f 1 -weight 1
grid $f - - - - - -sticky news
- set things [list $dlg.ls $dlg.sc $dlg.cc $dlg.b1]
+ set things [list $dlg.tf.ls $dlg.tf.sc $dlg.tf.cc $dlg.tf.b1]
if {![info exists ::widgetDemo]} {
- lappend things $dlg.b2 [ttk::sizegrip $dlg.sg]
+ lappend things $dlg.tf.b2
+ if {[tk windowingsystem] ne "aqua"} {
+ set things [linsert $things 0 [ttk::sizegrip $dlg.tf.sg]]
+ }
}
- grid {*}$things -sticky e
+ pack {*}$things -side right
+ if {[tk windowingsystem] eq "aqua"} {
+ pack configure {*}$things -padx {4 4} -pady {12 12}
+ pack configure [lindex $things 0] -padx {4 24}
+ pack configure [lindex $things end] -padx {16 4}
+ }
+ grid $dlg.tf - - - - - -sticky ew
if {[info exists ::widgetDemo]} {
grid [addSeeDismiss $dlg.buttons $dlg] - - - - - -sticky ew
}
@@ -226,8 +236,8 @@ proc CreateGUI {} {
grid columnconfigure $dlg 0 -weight 1
bind $dlg <Control-F2> {console show}
- bind $dlg <Return> [list $dlg.b1 invoke]
- bind $dlg <Escape> [list $dlg.b2 invoke]
+ bind $dlg <Return> [list $dlg.tf.b1 invoke]
+ bind $dlg <Escape> [list $dlg.tf.b2 invoke]
bind $dlg <Destroy> [namespace code [list Stop]]
wm protocol $dlg WM_DELETE_WINDOW [namespace code [list Exit $dlg]]
diff --git a/library/demos/widget b/library/demos/widget
index a8c2e84..9182904 100644
--- a/library/demos/widget
+++ b/library/demos/widget
@@ -10,7 +10,7 @@ exec wish "$0" "$@"
# separate ".tcl" files is this directory, which are sourced by this script as
# needed.
#
-# RCS: @(#) $Id: widget,v 1.50 2008/02/29 22:48:07 patthoyts Exp $
+# RCS: @(#) $Id: widget,v 1.51 2008/03/11 22:30:17 das Exp $
package require Tcl 8.5
package require Tk 8.5
@@ -358,6 +358,7 @@ addFormattedText {
@@demo ruler A ruler with adjustable tab stops
@@demo floor A building floor plan
@@demo cscroll A simple scrollable canvas
+ @@new
@@demo knightstour A Knight's tour of the chess board
@@subtitle Scales and Progress Bars