diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-10-25 21:06:25 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-10-25 21:06:25 (GMT) |
| commit | 0d5336db012f45753abace489f18f0ca299c6961 (patch) | |
| tree | b1bf3280a9046df99226158978502eeb26f5b0a3 /library/demos | |
| parent | e97381a6d921de403516d5b761539a450f4af83c (diff) | |
| parent | 1320b8a2a9c1269a345d44d673a7a35707fbbe9c (diff) | |
| download | tk-core-tip-626.zip tk-core-tip-626.tar.gz tk-core-tip-626.tar.bz2 | |
Merge 9.0core-tip-626
Diffstat (limited to 'library/demos')
| -rw-r--r-- | library/demos/fontchoose.tcl | 6 | ||||
| -rw-r--r-- | library/demos/goldberg.tcl | 4 | ||||
| -rw-r--r-- | library/demos/images/Tcl.svg | 36 | ||||
| -rw-r--r-- | library/demos/knightstour.tcl | 134 | ||||
| -rw-r--r-- | library/demos/labelframe.tcl | 16 | ||||
| -rw-r--r-- | library/demos/mac_styles.tcl | 14 | ||||
| -rw-r--r-- | library/demos/mac_wm.tcl | 18 | ||||
| -rw-r--r-- | library/demos/mclist.tcl | 16 | ||||
| -rw-r--r-- | library/demos/nl.msg | 6 | ||||
| -rw-r--r-- | library/demos/states.tcl | 6 | ||||
| -rw-r--r-- | library/demos/systray.tcl | 28 | ||||
| -rw-r--r-- | library/demos/text.tcl | 4 | ||||
| -rw-r--r-- | library/demos/ttkpane.tcl | 2 | ||||
| -rw-r--r-- | library/demos/twind.tcl | 2 | ||||
| -rw-r--r-- | library/demos/widget | 34 | ||||
| -rw-r--r-- | library/demos/windowicons.tcl | 2 |
16 files changed, 164 insertions, 164 deletions
diff --git a/library/demos/fontchoose.tcl b/library/demos/fontchoose.tcl index de9e854..6ae5479 100644 --- a/library/demos/fontchoose.tcl +++ b/library/demos/fontchoose.tcl @@ -20,7 +20,7 @@ catch {font create FontchooseDemoFont {*}[font actual TkDefaultFont]} # The font chooser needs to be configured and then shown. proc SelectFont {parent} { tk fontchooser configure -font FontchooseDemoFont \ - -command ApplyFont -parent $parent + -command ApplyFont -parent $parent tk fontchooser show } @@ -33,9 +33,9 @@ proc ApplyFont {font} { # bind $w <<TkFontchooserVisibility>> { if {[tk fontchooser configure -visible]} { - %W.f.font state disabled + %W.f.font state disabled } else { - %W.f.font state !disabled + %W.f.font state !disabled } } diff --git a/library/demos/goldberg.tcl b/library/demos/goldberg.tcl index 5a5b462..5323cce 100644 --- a/library/demos/goldberg.tcl +++ b/library/demos/goldberg.tcl @@ -1923,7 +1923,7 @@ proc scl {lst} { proc PlacedDialog {w msg {labelFnt {Helvetica 10}}} { if {[grab current] ne {}} { - return + return } destroy $w @@ -1954,7 +1954,7 @@ proc PlacedDialog {w msg {labelFnt {Helvetica 10}}} { proc ClosePlacedDialog {w} { set tl [winfo toplevel $w] if {![winfo exists $::PlacedDialogOldFocus]} { - set ::PlacedDialogOldFocus $tl + set ::PlacedDialogOldFocus $tl } focus $::PlacedDialogOldFocus set ::PlacedDialogOldFocus {} diff --git a/library/demos/images/Tcl.svg b/library/demos/images/Tcl.svg index 2c18ec1..05dd9a4 100644 --- a/library/demos/images/Tcl.svg +++ b/library/demos/images/Tcl.svg @@ -40,10 +40,10 @@ id="metadata2314"> <rdf:RDF> <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> </cc:Work> </rdf:RDF> </metadata> @@ -53,23 +53,23 @@ id="layer1" transform="translate(-311.79308,-365.73272)"> <g - style="opacity:1;display:inline" - id="g2244" - transform="translate(308.95998,366.42022)"> + style="opacity:1;display:inline" + id="g2244" + transform="translate(308.95998,366.42022)"> <path - id="path4426" - d="M 445.52492,372.22514 C 445.90652,395.55723 445.21415,418.63757 425.02492,440.56889 L 424.27492,441.41264 L 425.39992,441.41264 L 433.64992,441.53764 C 420.24442,469.42405 411.52244,497.23134 392.24367,525.00639 L 391.55617,526.00639 L 392.74367,525.78764 L 402.93117,523.85014 C 395.71427,542.16045 383.37359,554.28293 369.99367,558.35014 C 366.31107,506.78151 392.04593,461.26308 413.89992,415.88139 C 413.92002,415.83965 413.94233,415.79813 413.96242,415.75639 L 413.14992,415.19389 C 377.36425,455.2074 361.23872,511.6427 355.14992,558.19389 C 343.02146,551.34666 338.97913,542.28079 334.86867,529.94389 L 343.33742,533.50639 L 344.21242,533.88139 L 344.02492,532.94389 C 337.58858,504.32416 347.5814,483.78143 357.27492,456.78764 L 364.24367,461.44389 L 365.05617,462.00639 L 365.02492,461.03764 C 364.47892,439.10645 379.24595,417.08983 398.83742,397.44389 L 401.55617,404.72514 L 401.93117,405.69389 L 402.46242,404.78764 L 408.43117,394.85014 L 408.46242,394.78764 C 418.31429,381.21812 428.72988,376.80082 445.52492,372.22514 z " - style="fill:#c3b15f;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" - transform="translate(-324.02492,-364.63139)" /> + id="path4426" + d="M 445.52492,372.22514 C 445.90652,395.55723 445.21415,418.63757 425.02492,440.56889 L 424.27492,441.41264 L 425.39992,441.41264 L 433.64992,441.53764 C 420.24442,469.42405 411.52244,497.23134 392.24367,525.00639 L 391.55617,526.00639 L 392.74367,525.78764 L 402.93117,523.85014 C 395.71427,542.16045 383.37359,554.28293 369.99367,558.35014 C 366.31107,506.78151 392.04593,461.26308 413.89992,415.88139 C 413.92002,415.83965 413.94233,415.79813 413.96242,415.75639 L 413.14992,415.19389 C 377.36425,455.2074 361.23872,511.6427 355.14992,558.19389 C 343.02146,551.34666 338.97913,542.28079 334.86867,529.94389 L 343.33742,533.50639 L 344.21242,533.88139 L 344.02492,532.94389 C 337.58858,504.32416 347.5814,483.78143 357.27492,456.78764 L 364.24367,461.44389 L 365.05617,462.00639 L 365.02492,461.03764 C 364.47892,439.10645 379.24595,417.08983 398.83742,397.44389 L 401.55617,404.72514 L 401.93117,405.69389 L 402.46242,404.78764 L 408.43117,394.85014 L 408.46242,394.78764 C 418.31429,381.21812 428.72988,376.80082 445.52492,372.22514 z " + style="fill:#c3b15f;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" + transform="translate(-324.02492,-364.63139)" /> <path - sodipodi:nodetypes="ccccccccccccccccccccccc" - id="path7600" - d="M 121.54988,7.5808058 C 104.81215,12.147023 94.270242,16.613077 84.4375,30.15625 L 84.40625,30.21875 L 78.4375,40.15625 L 77.90625,41.0625 L 77.53125,40.09375 L 74.8125,32.8125 C 55.22103,52.45844 40.454,74.47506 41,96.40625 L 41.03125,97.375 L 40.21875,96.8125 L 33.25,92.15625 C 23.55648,119.15004 13.56366,139.69277 20,168.3125 L 20.1875,169.25 L 19.3125,168.875 L 10.9375,165.34375 C 10.96447,165.51523 11.003113,165.67421 11.03125,165.84375 C 15.080346,177.9015 19.176955,186.81713 31.125,193.5625 C 31.596616,189.95681 32.122231,186.27456 32.71875,182.5625 C 18.12816,148.39836 30.79293,123.2814 36.5625,100.6875 L 45.4375,105.8125 C 44.211577,84.657017 56.63174,61.842112 72.78125,41.9375 L 77.46875,50.1875 C 89.477498,25.486664 98.97512,15.57175 121.54988,7.5808058 z " - style="opacity:1;fill:#eff1cb;fill-opacity:1;fill-rule:evenodd;stroke:#eff1cb;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" /> + sodipodi:nodetypes="ccccccccccccccccccccccc" + id="path7600" + d="M 121.54988,7.5808058 C 104.81215,12.147023 94.270242,16.613077 84.4375,30.15625 L 84.40625,30.21875 L 78.4375,40.15625 L 77.90625,41.0625 L 77.53125,40.09375 L 74.8125,32.8125 C 55.22103,52.45844 40.454,74.47506 41,96.40625 L 41.03125,97.375 L 40.21875,96.8125 L 33.25,92.15625 C 23.55648,119.15004 13.56366,139.69277 20,168.3125 L 20.1875,169.25 L 19.3125,168.875 L 10.9375,165.34375 C 10.96447,165.51523 11.003113,165.67421 11.03125,165.84375 C 15.080346,177.9015 19.176955,186.81713 31.125,193.5625 C 31.596616,189.95681 32.122231,186.27456 32.71875,182.5625 C 18.12816,148.39836 30.79293,123.2814 36.5625,100.6875 L 45.4375,105.8125 C 44.211577,84.657017 56.63174,61.842112 72.78125,41.9375 L 77.46875,50.1875 C 89.477498,25.486664 98.97512,15.57175 121.54988,7.5808058 z " + style="opacity:1;fill:#eff1cb;fill-opacity:1;fill-rule:evenodd;stroke:#eff1cb;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" /> <path - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" - d="M 126.9375,-0.6875 L 126.40625,-0.59375 C 106.72165,2.83976 87.4508,10.07244 79,27.375 L 75.4375,21.15625 L 75.125,20.59375 L 74.65625,21.0625 C 64.96254,30.33838 54.55574,42.35306 46.875,54.15625 C 39.66528,65.23562 34.88327,76.07934 35.40625,84.375 L 30.375,78.09375 L 29.875,77.46875 L 29.53125,78.1875 C 23.40732,91.41649 17.22694,107.69157 13.53125,122.625 C 10.02725,136.78385 8.77244,149.67206 12.03125,157.78125 L 3.75,152.96875 L 3.0625,152.5625 L 3,153.375 C 1.44089,176.99202 11.0382,188.26833 22.0625,199.15625 L 12.875,201.4375 L 11.03125,201.90625 L 12.875,202.40625 C 18.14953,203.83558 23.15023,205.44485 26.625,208.125 C 30.09977,210.80515 32.09598,214.49082 31.5,220.375 L 31.5,220.40625 L 31.5,245.90625 L 31.5,246.0625 L 31.59375,246.1875 L 43.09375,262.6875 L 44,264 L 44,262.40625 L 44,223.53125 C 45.52181,216.98735 47.30807,212.4833 49.875,209.5 C 52.44193,206.5167 55.78211,204.98483 60.5625,204.40625 L 62.28125,204.1875 L 60.71875,203.46875 L 54.65625,200.59375 C 69.11174,191.89001 85.3013,170.55445 89.5625,150.28125 L 89.75,149.46875 L 88.96875,149.6875 L 81.46875,151.71875 C 88.13174,145.46249 94.84392,133.06721 101.21875,118.625 C 107.9798,103.3078 114.29247,85.96032 119.46875,72.09375 L 119.75,71.34375 L 118.96875,71.40625 L 113.1875,71.8125 C 120.3346,64.22669 124.30703,51.6996 126.25,38.46875 C 128.27227,24.69793 128.13035,10.1977 127,-0.15625 L 126.9375,-0.6875 z M 121.5,7.59375 C 121.8816,30.92584 121.18923,54.00618 101,75.9375 L 100.25,76.78125 L 101.375,76.78125 L 109.625,76.90625 C 96.2195,104.79266 87.49752,132.59995 68.21875,160.375 L 67.53125,161.375 L 68.71875,161.15625 L 78.90625,159.21875 C 71.68935,177.52906 59.34867,189.65154 45.96875,193.71875 C 42.28615,142.15012 68.02101,96.63169 89.875,51.25 C 89.8951,51.20826 89.91741,51.16674 89.9375,51.125 L 89.125,50.5625 C 53.33933,90.57601 37.2138,147.01131 31.125,193.5625 C 18.99654,186.71527 14.95421,177.6494 10.84375,165.3125 L 19.3125,168.875 L 20.1875,169.25 L 20,168.3125 C 13.56366,139.69277 23.55648,119.15004 33.25,92.15625 L 40.21875,96.8125 L 41.03125,97.375 L 41,96.40625 C 40.454,74.47506 55.22103,52.45844 74.8125,32.8125 L 77.53125,40.09375 L 77.90625,41.0625 L 78.4375,40.15625 L 84.40625,30.21875 L 84.4375,30.15625 C 94.28937,16.58673 104.70496,12.16943 121.5,7.59375 z " - id="path2177" /> + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;display:inline" + d="M 126.9375,-0.6875 L 126.40625,-0.59375 C 106.72165,2.83976 87.4508,10.07244 79,27.375 L 75.4375,21.15625 L 75.125,20.59375 L 74.65625,21.0625 C 64.96254,30.33838 54.55574,42.35306 46.875,54.15625 C 39.66528,65.23562 34.88327,76.07934 35.40625,84.375 L 30.375,78.09375 L 29.875,77.46875 L 29.53125,78.1875 C 23.40732,91.41649 17.22694,107.69157 13.53125,122.625 C 10.02725,136.78385 8.77244,149.67206 12.03125,157.78125 L 3.75,152.96875 L 3.0625,152.5625 L 3,153.375 C 1.44089,176.99202 11.0382,188.26833 22.0625,199.15625 L 12.875,201.4375 L 11.03125,201.90625 L 12.875,202.40625 C 18.14953,203.83558 23.15023,205.44485 26.625,208.125 C 30.09977,210.80515 32.09598,214.49082 31.5,220.375 L 31.5,220.40625 L 31.5,245.90625 L 31.5,246.0625 L 31.59375,246.1875 L 43.09375,262.6875 L 44,264 L 44,262.40625 L 44,223.53125 C 45.52181,216.98735 47.30807,212.4833 49.875,209.5 C 52.44193,206.5167 55.78211,204.98483 60.5625,204.40625 L 62.28125,204.1875 L 60.71875,203.46875 L 54.65625,200.59375 C 69.11174,191.89001 85.3013,170.55445 89.5625,150.28125 L 89.75,149.46875 L 88.96875,149.6875 L 81.46875,151.71875 C 88.13174,145.46249 94.84392,133.06721 101.21875,118.625 C 107.9798,103.3078 114.29247,85.96032 119.46875,72.09375 L 119.75,71.34375 L 118.96875,71.40625 L 113.1875,71.8125 C 120.3346,64.22669 124.30703,51.6996 126.25,38.46875 C 128.27227,24.69793 128.13035,10.1977 127,-0.15625 L 126.9375,-0.6875 z M 121.5,7.59375 C 121.8816,30.92584 121.18923,54.00618 101,75.9375 L 100.25,76.78125 L 101.375,76.78125 L 109.625,76.90625 C 96.2195,104.79266 87.49752,132.59995 68.21875,160.375 L 67.53125,161.375 L 68.71875,161.15625 L 78.90625,159.21875 C 71.68935,177.52906 59.34867,189.65154 45.96875,193.71875 C 42.28615,142.15012 68.02101,96.63169 89.875,51.25 C 89.8951,51.20826 89.91741,51.16674 89.9375,51.125 L 89.125,50.5625 C 53.33933,90.57601 37.2138,147.01131 31.125,193.5625 C 18.99654,186.71527 14.95421,177.6494 10.84375,165.3125 L 19.3125,168.875 L 20.1875,169.25 L 20,168.3125 C 13.56366,139.69277 23.55648,119.15004 33.25,92.15625 L 40.21875,96.8125 L 41.03125,97.375 L 41,96.40625 C 40.454,74.47506 55.22103,52.45844 74.8125,32.8125 L 77.53125,40.09375 L 77.90625,41.0625 L 78.4375,40.15625 L 84.40625,30.21875 L 84.4375,30.15625 C 94.28937,16.58673 104.70496,12.16943 121.5,7.59375 z " + id="path2177" /> </g> </g> </svg> diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl index 76b6a4f..8da89ba 100644 --- a/library/demos/knightstour.tcl +++ b/library/demos/knightstour.tcl @@ -27,11 +27,11 @@ package require tk proc ValidMoves {square} { set moves {} foreach pair {{-1 -2} {-2 -1} {-2 1} {-1 2} {1 2} {2 1} {2 -1} {1 -2}} { - set col [expr {($square % 8) + [lindex $pair 0]}] - set row [expr {($square / 8) + [lindex $pair 1]}] - if {$row >= 0 && $row < 8 && $col >= 0 && $col < 8} { - lappend moves [expr {$row * 8 + $col}] - } + set col [expr {($square % 8) + [lindex $pair 0]}] + set row [expr {($square / 8) + [lindex $pair 1]}] + if {$row >= 0 && $row < 8 && $col >= 0 && $col < 8} { + lappend moves [expr {$row * 8 + $col}] + } } return $moves } @@ -41,9 +41,9 @@ proc CheckSquare {square} { variable visited set moves 0 foreach test [ValidMoves $square] { - if {[lsearch -exact -integer $visited $test] < 0} { - incr moves - } + if {[lsearch -exact -integer $visited $test] < 0} { + incr moves + } } return $moves } @@ -55,17 +55,17 @@ proc Next {square} { set minimum 9 set nextSquare -1 foreach testSquare [ValidMoves $square] { - if {[lsearch -exact -integer $visited $testSquare] < 0} { - set count [CheckSquare $testSquare] - if {$count < $minimum} { - set minimum $count - set nextSquare $testSquare - } elseif {$count == $minimum} { - # to remove the enhancement to Warnsdorff's rule - # remove the next line: - set nextSquare [Edgemost $nextSquare $testSquare] - } - } + if {[lsearch -exact -integer $visited $testSquare] < 0} { + set count [CheckSquare $testSquare] + if {$count < $minimum} { + set minimum $count + set nextSquare $testSquare + } elseif {$count == $minimum} { + # to remove the enhancement to Warnsdorff's rule + # remove the next line: + set nextSquare [Edgemost $nextSquare $testSquare] + } + } } return $nextSquare } @@ -98,23 +98,23 @@ proc MovePiece {dlg last square} { lappend visited $square set next [Next $square] if {$next ne -1} { - variable aid [after $delay [list MovePiece $dlg $square $next]] + variable aid [after $delay [list MovePiece $dlg $square $next]] } else { - $dlg.tf.b1 configure -state normal - if {[llength $visited] == 64} { - variable initial - if {$initial == $square} { - $dlg.f.txt insert end "Closed tour!" - } else { - $dlg.f.txt insert end "Success" - if {$continuous} { - after [expr {$delay * 2}] [namespace code \ - [list Tour $dlg [expr {int(rand() * 64)}]]] - } - } - } else { - $dlg.f.txt insert end "FAILED!" - } + $dlg.tf.b1 configure -state normal + if {[llength $visited] == 64} { + variable initial + if {$initial == $square} { + $dlg.f.txt insert end "Closed tour!" + } else { + $dlg.f.txt insert end "Success" + if {$continuous} { + after [expr {$delay * 2}] [namespace code \ + [list Tour $dlg [expr {int(rand() * 64)}]]] + } + } + } else { + $dlg.f.txt insert end "FAILED!" + } } } @@ -124,11 +124,11 @@ proc Tour {dlg {square {}}} { $dlg.f.txt delete 1.0 end $dlg.tf.b1 configure -state disabled for {set n 0} {$n < 64} {incr n} { - $dlg.f.c itemconfigure $n -state disabled -outline black + $dlg.f.c itemconfigure $n -state disabled -outline black } if {$square eq {}} { - set coords [lrange [$dlg.f.c coords knight] 0 1] - set square [expr {[$dlg.f.c find closest {*}$coords 0 65]-1}] + set coords [lrange [$dlg.f.c coords knight] 0 1] + set square [expr {[$dlg.f.c find closest {*}$coords 0 65]-1}] } variable initial $square after idle [list MovePiece $dlg $initial $initial] @@ -157,9 +157,9 @@ proc DragStart {w x y} { proc DragMotion {w x y} { variable dragging if {[info exists dragging]} { - $w move selected [expr {$x - [lindex $dragging 0]}] \ - [expr {$y - [lindex $dragging 1]}] - variable dragging [list $x $y] + $w move selected [expr {$x - [lindex $dragging 0]}] \ + [expr {$y - [lindex $dragging 1]}] + variable dragging [list $x $y] } } proc DragEnd {w x y} { @@ -177,7 +177,7 @@ proc CreateGUI {} { set f [ttk::frame $dlg.f] set c [canvas $f.c -width 192p -height 192p] text $f.txt -width 12 -height 1 -padx 3p \ - -yscrollcommand [list $f.vs set] -font TkFixedFont + -yscrollcommand [list $f.vs set] -font TkFixedFont ttk::scrollbar $f.vs -command [list $f.txt yview] variable speed 1400 @@ -185,41 +185,41 @@ proc CreateGUI {} { variable continuous 0 ttk::frame $dlg.tf ttk::checkbutton $dlg.tf.cc -text Repeat \ - -variable [namespace which -variable continuous] + -variable [namespace which -variable continuous] ttk::scale $dlg.tf.sc -from 0 -to 1992 -command [list SetDelay] \ - -variable [namespace which -variable speed] + -variable [namespace which -variable speed] ttk::label $dlg.tf.ls -text Speed 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 >= 0} {incr row -1} { - for {set col 0} {$col < 8} {incr col} { - if {(($col & 1) ^ ($row & 1))} { - set fill tan3 ; set dfill tan4 - } else { - set fill bisque ; set dfill bisque3 - } - set coords [list [expr {$col * 24 + 3}]p \ + for {set col 0} {$col < 8} {incr col} { + if {(($col & 1) ^ ($row & 1))} { + set fill tan3 ; set dfill tan4 + } else { + set fill bisque ; set dfill bisque3 + } + set coords [list [expr {$col * 24 + 3}]p \ [expr {$row * 24 + 3}]p \ - [expr {$col * 24 + 24}]p \ + [expr {$col * 24 + 24}]p \ [expr {$row * 24 + 24}]p] - $c create rectangle $coords -fill $fill -disabledfill $dfill \ - -width 1.5p -state disabled -outline black - } + $c create rectangle $coords -fill $fill -disabledfill $dfill \ + -width 1.5p -state disabled -outline black + } } if {[tk windowingsystem] ne "x11"} { - catch {eval font create KnightFont -size 18} - $c create text 0 0 -font KnightFont -text "♞" \ - -anchor nw -tags knight -fill black -activefill "#600000" + catch {eval font create KnightFont -size 18} + $c create text 0 0 -font KnightFont -text "♞" \ + -anchor nw -tags knight -fill black -activefill "#600000" } else { - # On X11 we cannot reliably tell if the ♞ glyph is available - # so just use a polygon - set pts { - 2 25 24 25 21 19 20 8 14 0 10 0 0 13 0 16 - 2 17 4 14 5 15 3 17 5 17 9 14 10 15 5 21 - } - $c create polygon $pts -tag knight -offset 8 \ - -fill black -activefill "#600000" + # On X11 we cannot reliably tell if the ♞ glyph is available + # so just use a polygon + set pts { + 2 25 24 25 21 19 20 8 14 0 10 0 0 13 0 16 + 2 17 4 14 5 15 3 17 5 17 9 14 10 15 5 21 + } + $c create polygon $pts -tag knight -offset 8 \ + -fill black -activefill "#600000" set scaleFactor [expr {$tk::scalingPct / 100.0}] $c scale knight 0 0 $scaleFactor $scaleFactor } @@ -248,7 +248,7 @@ proc CreateGUI {} { } grid $dlg.tf - - - - - -sticky ew if {[info exists ::widgetDemo]} { - grid [addSeeDismiss $dlg.buttons $dlg] - - - - - -sticky ew + grid [addSeeDismiss $dlg.buttons $dlg] - - - - - -sticky ew } grid rowconfigure $dlg 0 -weight 1 diff --git a/library/demos/labelframe.tcl b/library/demos/labelframe.tcl index 08e8a23..0f400ed 100644 --- a/library/demos/labelframe.tcl +++ b/library/demos/labelframe.tcl @@ -40,7 +40,7 @@ grid $w.f -row 0 -column 0 -pady 2m -padx 2m foreach value {1 2 3 4} { radiobutton $w.f.b$value -text "This is value $value" \ - -variable lfdummy -value $value + -variable lfdummy -value $value pack $w.f.b$value -side top -fill x -pady 1.5p } @@ -49,18 +49,18 @@ foreach value {1 2 3 4} { proc lfEnableButtons {w} { foreach child [winfo children $w] { - if {$child == "$w.cb"} continue - if {$::lfdummy2} { - $child configure -state normal - } else { - $child configure -state disabled - } + if {$child == "$w.cb"} continue + if {$::lfdummy2} { + $child configure -state normal + } else { + $child configure -state disabled + } } } labelframe $w.f2 -pady 1.5p -padx 1.5p checkbutton $w.f2.cb -text "Use this option." -variable lfdummy2 \ - -command "lfEnableButtons $w.f2" -padx 0 + -command "lfEnableButtons $w.f2" -padx 0 $w.f2 configure -labelwidget $w.f2.cb grid $w.f2 -row 0 -column 1 -pady 2m -padx 2m diff --git a/library/demos/mac_styles.tcl b/library/demos/mac_styles.tcl index 3fff03c..1d1b6d1 100644 --- a/library/demos/mac_styles.tcl +++ b/library/demos/mac_styles.tcl @@ -123,7 +123,7 @@ pack [ttk::radiobutton $radio.r2 -text "Radio 2" -variable .radioVar -value 2] - set triangle [ttk::checkbutton $buttonFrame.triangle -style Item -variable TriangleVar] bind $triangle <Button-1> {toggleTriangle %W} set bonjour [ttk::button $buttonFrame.bonjour -style ImageButton -text Bonjour \ - -image {bonjour pressed bonjour1}] + -image {bonjour pressed bonjour1}] set feather [ttk::button $buttonFrame.feather -style ImageButton -text Tk \ -image {tkfeather pressed tkfeather1}] set gradient [ttk::frame $buttonFrame.gradient] @@ -245,16 +245,16 @@ if { [wm attributes $w -isdark] } { } proc beLight {f w} { wm attributes $w -appearance aqua - $f.dark state !selected - $f.light state selected - after 10 $f.light state !hover + # A small delay is needed for the appearance change to complete. + after 10 [list $f.dark state !selected] + after 10 [list $f.light state selected] } proc beDark {f w} { wm attributes $w -appearance darkaqua - $f.light state !selected - $f.dark state selected - after 10 $f.dark state !hover + # A small delay is needed for the appearance change to complete. + after 10 [list $f.light state !selected] + after 10 [list $f.dark state selected] } $w.notebook add $appearanceFrame -text "Appearance" diff --git a/library/demos/mac_wm.tcl b/library/demos/mac_wm.tcl index 105c12c..eba4f03 100644 --- a/library/demos/mac_wm.tcl +++ b/library/demos/mac_wm.tcl @@ -46,23 +46,23 @@ proc launch {name windowInfo class} { # titled if {$class == "nswindow"} { ttk::checkbutton $f.stylemask.titled -text titled -variable $name.titled \ - -command [list setbit $name $f.stylemask.titled titled] + -command [list setbit $name $f.stylemask.titled titled] $f.stylemask.titled state selected grid $f.stylemask.titled -row 0 -column 0 -sticky w } # closable ttk::checkbutton $f.stylemask.closable -text closable -variable $name.closable \ - -command [list setbit $name $f.stylemask.closable closable] + -command [list setbit $name $f.stylemask.closable closable] $f.stylemask.closable state selected grid $f.stylemask.closable -row 1 -column 0 -sticky w # miniaturizableable ttk::checkbutton $f.stylemask.miniaturizable -text miniaturizable \ -variable $name.miniaturizable \ - -command [list setbit $name $f.stylemask.miniaturizable miniaturizable] + -command [list setbit $name $f.stylemask.miniaturizable miniaturizable] if {$class == "nswindow"} { - $f.stylemask.miniaturizable state selected + $f.stylemask.miniaturizable state selected } else { - $f.stylemask.miniaturizable state !alternate + $f.stylemask.miniaturizable state !alternate } grid $f.stylemask.miniaturizable -row 2 -column 0 -sticky w # resizable @@ -124,10 +124,10 @@ proc setbit {win cb bitname} { set bits [wm attributes $win -stylemask] set index [lsearch $bits $bitname] if {$index >= 0 && !$state} { - set bits [lreplace $bits $index $index] + set bits [lreplace $bits $index $index] } if {$index < 0 && $state} { - lappend bits $bitname + lappend bits $bitname } wm attributes $win -stylemask $bits } @@ -192,8 +192,8 @@ proc launchModernWindow {} { frame .mod.left -width 220 -height 400 -background systemWindowBackgroundColor catch { font create leftFont -family .AppleSystemUIFont -size 11 - font create rightFont -family .AppleSystemUIFont -size 16 - font create codeFont -family Courier -size 16 + font create rightFont -family .AppleSystemUIFont -size 16 + font create codeFont -family Courier -size 16 } grid [ttk::label .mod.left.spacer -padding {220 30 0 0}] -row 0 -column 0 grid [ttk::radiobutton .mod.left.about -text About -style SidebarButton \ diff --git a/library/demos/mclist.tcl b/library/demos/mclist.tcl index a60a00f..5335490 100644 --- a/library/demos/mclist.tcl +++ b/library/demos/mclist.tcl @@ -157,14 +157,14 @@ proc SortBy {tree col direction} { set mclistGrid 0 proc tglGrid {} { if {$::mclistGrid} { - .mclist.tree configure -stripe 1 - foreach col [.mclist.tree cget -columns] { - .mclist.tree column $col -separator 1 - } + .mclist.tree configure -stripe 1 + foreach col [.mclist.tree cget -columns] { + .mclist.tree column $col -separator 1 + } } else { - .mclist.tree configure -stripe 0 - foreach col [.mclist.tree cget -columns] { - .mclist.tree column $col -separator 0 - } + .mclist.tree configure -stripe 0 + foreach col [.mclist.tree cget -columns] { + .mclist.tree column $col -separator 0 + } } } diff --git a/library/demos/nl.msg b/library/demos/nl.msg index dc80c15..60ca47c 100644 --- a/library/demos/nl.msg +++ b/library/demos/nl.msg @@ -66,15 +66,15 @@ ::msgcat::mcset nl "Listboxes" "Keuzelijsten" ::msgcat::mcset nl "The 50 states" "De 50 staten van de VS" ::msgcat::mcset nl "Colors: change the color scheme for the application" \ - "Kleuren: verander het kleurenschema voor het programma" + "Kleuren: verander het kleurenschema voor het programma" ::msgcat::mcset nl "A collection of famous and infamous sayings" \ - "Beroemde en beruchte citaten en gezegden" + "Beroemde en beruchte citaten en gezegden" ::msgcat::mcset nl "Entries and Spin-boxes" "Invulvelden en Spinboxen" ::msgcat::mcset nl "Entries without scrollbars" "Invulvelden zonder schuifbalk" ::msgcat::mcset nl "Entries with scrollbars" "Invulvelden met schuifbalk" ::msgcat::mcset nl "Validated entries and password fields" \ - "Invulvelden met controle of wachtwoorden" + "Invulvelden met controle of wachtwoorden" ::msgcat::mcset nl "Spin-boxes" "Spinboxen" ::msgcat::mcset nl "Simple Rolodex-like form" "Simpel kaartsysteem" diff --git a/library/demos/states.tcl b/library/demos/states.tcl index 4e14fd5..e25ee81 100644 --- a/library/demos/states.tcl +++ b/library/demos/states.tcl @@ -23,9 +23,9 @@ labelframe $w.justif -text Justification foreach c {Left Center Right} { set lower [string tolower $c] radiobutton $w.justif.$lower -text $c -variable just \ - -relief flat -value $lower -anchor w \ - -command "$w.frame.list configure -justify \$just" \ - -tristatevalue "multi" + -relief flat -value $lower -anchor w \ + -command "$w.frame.list configure -justify \$just" \ + -tristatevalue "multi" pack $w.justif.$lower -side left -pady 1.5p -fill x } pack $w.justif diff --git a/library/demos/systray.tcl b/library/demos/systray.tcl index 6954143..3406f0c 100644 --- a/library/demos/systray.tcl +++ b/library/demos/systray.tcl @@ -26,10 +26,10 @@ $iconmenu add command -label "Status" -command { puts "status icon clicked" } $iconmenu add command -label "Exit" -command exit pack [label $w.l -text "This demonstration showcases - the tk systray and tk sysnotify commands. - Running this demo creates the systray icon. - Clicking the buttons below modifies and destroys the icon - and displays the notification."] + the tk systray and tk sysnotify commands. + Running this demo creates the systray icon. + Clicking the buttons below modifies and destroys the icon + and displays the notification."] image create photo book -data R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAACwAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IMQCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc0yv+DVSEUuFxIAOw== @@ -45,20 +45,20 @@ pack $w.f $w.b3 -fill x -padx 3p -pady 3p proc create {} { global trayIconExists if {$trayIconExists} { - tk_messageBox -message "Systray icon already exists" - return + tk_messageBox -message "Systray icon already exists" + return } tk systray create -image book -text "Systray sample" \ - -button1 {puts "foo"} \ - -button3 {tk_popup $iconmenu [winfo pointerx .] [winfo pointery .]} + -button1 {puts "foo"} \ + -button3 {tk_popup $iconmenu [winfo pointerx .] [winfo pointery .]} set trayIconExists true } proc modify {} { global trayIconExists if {!$trayIconExists} { - tk_messageBox -message "Please create systray icon first" - return + tk_messageBox -message "Please create systray icon first" + return } image create photo page -data R0lGODlhCwAPAKIAAP//////AMDAwICAgAAA/wAAAAAAAAAAACwAAAAACwAPAAADMzi6CzAugiAgDGE68aB0RXgRJBFVX0SNpQlUWfahQOvSsgrX7eZJMlQMWBEYj8iQchlKAAA7 tk systray configure -image page @@ -70,8 +70,8 @@ proc modify {} { proc notify {} { global trayIconExists if {!$trayIconExists} { - tk_messageBox -message "Please create systray icon first" - return + tk_messageBox -message "Please create systray icon first" + return } tk sysnotify "Alert" "This is an alert" } @@ -79,8 +79,8 @@ proc notify {} { proc remove {} { global trayIconExists if {!$trayIconExists} { - tk_messageBox -message "Systray icon was already destroyed" - return + tk_messageBox -message "Systray icon was already destroyed" + return } tk systray destroy set trayIconExists false diff --git a/library/demos/text.tcl b/library/demos/text.tcl index 130a4a5..189cb2d 100644 --- a/library/demos/text.tcl +++ b/library/demos/text.tcl @@ -30,11 +30,11 @@ pack $w.text -expand yes -fill both # TIP 324 Demo: [tk fontchooser] proc fontchooserToggle {} { tk fontchooser [expr {[tk fontchooser configure -visible] ? - "hide" : "show"}] + "hide" : "show"}] } proc fontchooserVisibility {w} { $w configure -text [expr {[tk fontchooser configure -visible] ? - "Hide Font Dialog" : "Show Font Dialog"}] + "Hide Font Dialog" : "Show Font Dialog"}] } proc fontchooserFocus {w} { tk fontchooser configure -font [$w cget -font] \ diff --git a/library/demos/ttkpane.tcl b/library/demos/ttkpane.tcl index 749f940..87c7b6d 100644 --- a/library/demos/ttkpane.tcl +++ b/library/demos/ttkpane.tcl @@ -67,7 +67,7 @@ set testzones { set zones {} foreach zone $testzones { if {![catch {clock format 0 -timezone $zone}]} { - lappend zones $zone + lappend zones $zone } } if {[llength $zones] < 2} { lappend zones -0200 :GMT :UTC +0200 } diff --git a/library/demos/twind.tcl b/library/demos/twind.tcl index b974456..ddfc30e 100644 --- a/library/demos/twind.tcl +++ b/library/demos/twind.tcl @@ -353,6 +353,6 @@ proc textSplitWindow {textW} { $w.pane add $t -stretch always } } else { - return + return } } diff --git a/library/demos/widget b/library/demos/widget index d2dff1c..5e3373c 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -31,26 +31,26 @@ if {[tk windowingsystem] eq "x11"} { if {"defaultFont" ni [font names]} { # TIP #145 defines some standard named fonts if {"TkDefaultFont" in [font names] && "TkFixedFont" in [font names]} { - # FIX ME: the following technique of cloning the font to copy it works - # fine but means that if the system font is changed by Tk - # cannot update the copied font. font alias might be useful - # here -- or fix the app to use TkDefaultFont etc. - font create mainFont {*}[font configure TkDefaultFont] - font create fixedFont {*}[font configure TkFixedFont] - font create boldFont {*}[font configure TkDefaultFont] -weight bold - font create titleFont {*}[font configure TkDefaultFont] -weight bold - font create statusFont {*}[font configure TkDefaultFont] - font create varsFont {*}[font configure TkDefaultFont] + # FIX ME: the following technique of cloning the font to copy it works + # fine but means that if the system font is changed by Tk + # cannot update the copied font. font alias might be useful + # here -- or fix the app to use TkDefaultFont etc. + font create mainFont {*}[font configure TkDefaultFont] + font create fixedFont {*}[font configure TkFixedFont] + font create boldFont {*}[font configure TkDefaultFont] -weight bold + font create titleFont {*}[font configure TkDefaultFont] -weight bold + font create statusFont {*}[font configure TkDefaultFont] + font create varsFont {*}[font configure TkDefaultFont] if {[tk windowingsystem] eq "aqua"} { font configure titleFont -size 17 } } else { - font create mainFont -family Helvetica -size 12 - font create fixedFont -family Courier -size 10 - font create boldFont -family Helvetica -size 12 -weight bold - font create titleFont -family Helvetica -size 18 -weight bold - font create statusFont -family Helvetica -size 10 - font create varsFont -family Helvetica -size 14 + font create mainFont -family Helvetica -size 12 + font create fixedFont -family Courier -size 10 + font create boldFont -family Helvetica -size 12 -weight bold + font create titleFont -family Helvetica -size 18 -weight bold + font create statusFont -family Helvetica -size 10 + font create varsFont -family Helvetica -size 14 } } @@ -142,7 +142,7 @@ if {[tk windowingsystem] ne "aqua"} { -command {tkAboutDialog} -accelerator [mc "<F1>"] bind . <F1> {tkAboutDialog} .menuBar.file add sep - if {[string match win* [tk windowingsystem]]} { + if {[tk windowingsystem] eq "win32"} { # Windows doesn't usually have a Meta key ::tk::AmpMenuArgs .menuBar.file add command -label [mc "&Quit"] \ -command {exit} -accelerator [mc "Ctrl+Q"] diff --git a/library/demos/windowicons.tcl b/library/demos/windowicons.tcl index 0c1e0c0..13c514d 100644 --- a/library/demos/windowicons.tcl +++ b/library/demos/windowicons.tcl @@ -99,7 +99,7 @@ image create photo icon2 icon2 copy icon -zoom [expr {$tk::scalingPct / 100}] pack [button $w.i -text "Set Window Icon to Globe" -image icon2 \ - -compound top -command {wm iconphoto . icon}] -fill x -padx 3p + -compound top -command {wm iconphoto . icon}] -fill x -padx 3p pack [button $w.b -text "Set Badge to 3" -command {wm iconbadge . 3}] \ -fill x -padx 3p pack [button $w.e -text "Set Badge to 11" -command {wm iconbadge . 11}] \ |
