summaryrefslogtreecommitdiffstats
path: root/library/demos
diff options
context:
space:
mode:
authorculler <culler>2020-11-10 13:59:25 (GMT)
committerculler <culler>2020-11-10 13:59:25 (GMT)
commitd94200fdcf927707b43670e7751208ea902b382e (patch)
treec8f724ce055955eef67c4b799866138c5389715d /library/demos
parenta49d6e52a72b1f086503ae32cb28b0da62e5fa99 (diff)
parent6133a711414cfb8fcc3a8b52ecf25b59a09e5800 (diff)
downloadtk-d94200fdcf927707b43670e7751208ea902b382e.zip
tk-d94200fdcf927707b43670e7751208ea902b382e.tar.gz
tk-d94200fdcf927707b43670e7751208ea902b382e.tar.bz2
Merge main
Diffstat (limited to 'library/demos')
-rw-r--r--library/demos/bind.tcl12
-rw-r--r--library/demos/cscroll.tcl56
-rw-r--r--library/demos/ctext.tcl6
-rw-r--r--library/demos/dialog1.tcl14
-rw-r--r--library/demos/entry3.tcl2
-rw-r--r--library/demos/floor.tcl9
-rw-r--r--library/demos/fontchoose.tcl6
-rw-r--r--library/demos/goldberg.tcl8
-rw-r--r--library/demos/items.tcl21
-rw-r--r--library/demos/ixset2
-rw-r--r--library/demos/knightstour.tcl16
-rw-r--r--library/demos/menu.tcl2
-rw-r--r--library/demos/pendulum.tcl4
-rw-r--r--library/demos/tclIndex118
-rw-r--r--library/demos/tcolor2
-rw-r--r--library/demos/toolbar.tcl2
-rw-r--r--library/demos/ttkbut.tcl2
-rw-r--r--library/demos/ttkprogress.tcl2
-rw-r--r--library/demos/unicodeout.tcl50
-rw-r--r--library/demos/widget11
20 files changed, 172 insertions, 173 deletions
diff --git a/library/demos/bind.tcl b/library/demos/bind.tcl
index 9146362..8b56639 100644
--- a/library/demos/bind.tcl
+++ b/library/demos/bind.tcl
@@ -67,12 +67,12 @@ foreach tag {d1 d2 d3 d4 d5 d6} {
$w.text tag bind $tag <Leave> "$w.text tag configure $tag $normal"
}
# Main widget program sets variable tk_demoDirectory
-$w.text tag bind d1 <Button-1> {source [file join $tk_demoDirectory items.tcl]}
-$w.text tag bind d2 <Button-1> {source [file join $tk_demoDirectory plot.tcl]}
-$w.text tag bind d3 <Button-1> {source [file join $tk_demoDirectory ctext.tcl]}
-$w.text tag bind d4 <Button-1> {source [file join $tk_demoDirectory arrow.tcl]}
-$w.text tag bind d5 <Button-1> {source [file join $tk_demoDirectory ruler.tcl]}
-$w.text tag bind d6 <Button-1> {source [file join $tk_demoDirectory cscroll.tcl]}
+$w.text tag bind d1 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory items.tcl]}
+$w.text tag bind d2 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory plot.tcl]}
+$w.text tag bind d3 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory ctext.tcl]}
+$w.text tag bind d4 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory arrow.tcl]}
+$w.text tag bind d5 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory ruler.tcl]}
+$w.text tag bind d6 <Button-1> {source -encoding utf-8 [file join $tk_demoDirectory cscroll.tcl]}
$w.text mark set insert 0.0
$w.text configure -state disabled
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl
index c0c30ee..d210c7d 100644
--- a/library/demos/cscroll.tcl
+++ b/library/demos/cscroll.tcl
@@ -56,45 +56,61 @@ for {set i 0} {$i < 20} {incr i} {
$c bind all <Enter> "scrollEnter $c"
$c bind all <Leave> "scrollLeave $c"
$c bind all <Button-1> "scrollButton $c"
-bind $c <Button-2> "$c scan mark %x %y"
-bind $c <B2-Motion> "$c scan dragto %x %y"
-if {[tk windowingsystem] eq "aqua"} {
+if {([tk windowingsystem] eq "aqua") && ![package vsatisfies [package provide Tk] 8.7-]} {
+ bind $c <Button-3> "$c scan mark %x %y"
+ bind $c <B3-Motion> "$c scan dragto %x %y"
bind $c <MouseWheel> {
- %W yview scroll [expr {-(%D)}] units
+ %W yview scroll [expr {-%D}] units
}
bind $c <Option-MouseWheel> {
- %W yview scroll [expr {-10 * (%D)}] units
+ %W yview scroll [expr {-10*%D}] units
}
bind $c <Shift-MouseWheel> {
- %W xview scroll [expr {-(%D)}] units
+ %W xview scroll [expr {-%D}] units
}
bind $c <Shift-Option-MouseWheel> {
- %W xview scroll [expr {-10 * (%D)}] units
+ %W xview scroll [expr {-10*%D}] units
}
} else {
+ bind $c <Button-2> "$c scan mark %x %y"
+ bind $c <B2-Motion> "$c scan dragto %x %y"
# We must make sure that positive and negative movements are rounded
# equally to integers, avoiding the problem that
- # (int)1/30 = 0,
+ # (int)1/-30 = -1,
# but
- # (int)-1/30 = -1
+ # (int)-1/-30 = 0
# The following code ensure equal +/- behaviour.
bind $c <MouseWheel> {
if {%D >= 0} {
- %W yview scroll [expr {-%D/30}] units
+ %W yview scroll [expr {%D/-30}] units
} else {
- %W yview scroll [expr {(29-%D)/30}] units
+ %W yview scroll [expr {(%D-29)/-30}] units
+ }
+ }
+ bind $c <Option-MouseWheel> {
+ if {%D >= 0} {
+ %W yview scroll [expr {%D/-3}] units
+ } else {
+ %W yview scroll [expr {(%D-2)/-3}] units
}
}
bind $c <Shift-MouseWheel> {
if {%D >= 0} {
- %W xview scroll [expr {-%D/30}] units
+ %W xview scroll [expr {%D/-30}] units
} else {
- %W xview scroll [expr {(29-%D)/30}] units
+ %W xview scroll [expr {(%D-29)/-30}] units
+ }
+ }
+ bind $c <Shift-Option-MouseWheel> {
+ if {%D >= 0} {
+ %W xview scroll [expr {%D/-3}] units
+ } else {
+ %W xview scroll [expr {(%D-2)/-3}] units
}
}
}
-if {[tk windowingsystem] eq "x11"} {
+if {[tk windowingsystem] eq "x11" && ![package vsatisfies [package provide Tk] 8.7-]} {
# Support for mousewheels on Linux/Unix commonly comes through mapping
# the wheel to the extended buttons. If you have a mousewheel, find
# Linux configuration info at:
@@ -119,18 +135,6 @@ if {[tk windowingsystem] eq "x11"} {
%W xview scroll 5 units
}
}
- if {[package vsatisfies [package provide Tk] 8.7]} {
- bind $c <Button-6> {
- if {!$tk_strictMotif} {
- %W xview scroll -5 units
- }
- }
- bind $c <Button-7> {
- if {!$tk_strictMotif} {
- %W xview scroll 5 units
- }
- }
- }
}
diff --git a/library/demos/ctext.tcl b/library/demos/ctext.tcl
index 502c9d0..d3fec33 100644
--- a/library/demos/ctext.tcl
+++ b/library/demos/ctext.tcl
@@ -50,7 +50,11 @@ $c bind text <Return> "textInsert $c \\n"
$c bind text <Control-h> "textBs $c"
$c bind text <BackSpace> "textBs $c"
$c bind text <Delete> "textDel $c"
-$c bind text <Button-2> "textPaste $c @%x,%y"
+if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
+ $c bind text <Button-3> "textPaste $c @%x,%y"
+} else {
+ $c bind text <Button-2> "textPaste $c @%x,%y"
+}
# Next, create some items that allow the text's anchor position
# to be edited.
diff --git a/library/demos/dialog1.tcl b/library/demos/dialog1.tcl
index 976e955..66d8c9a 100644
--- a/library/demos/dialog1.tcl
+++ b/library/demos/dialog1.tcl
@@ -2,16 +2,16 @@
#
# This demonstration script creates a dialog box with a local grab.
-interp create slave
-load {} Tk slave
-slave eval {
- wm title . slave
+interp create child
+load {} Tk child
+child eval {
+ wm title . child
wm geometry . +700+30
pack [text .t -width 30 -height 10]
}
after idle {.dialog1.msg configure -wraplength 4i}
-set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "slave" which was created by a slave interpreter.} \
+set i [tk_dialog .dialog1 "Dialog with local grab" {This is a modal dialog box. It uses Tk's "grab" command to create a "local grab" on the dialog box. The grab prevents any mouse or keyboard events from getting to any other windows in the application until you have answered the dialog by invoking one of the buttons below. However, you can still interact with other applications. For example, you should be able to edit text in the window named "child" which was created by a child interpreter.} \
info 0 OK Cancel {Show Code}]
switch $i {
@@ -20,6 +20,6 @@ switch $i {
2 {showCode .dialog1}
}
-if {[interp exists slave]} {
- interp delete slave
+if {[interp exists child]} {
+ interp delete child
}
diff --git a/library/demos/entry3.tcl b/library/demos/entry3.tcl
index d4435c6..acde1b3 100644
--- a/library/demos/entry3.tcl
+++ b/library/demos/entry3.tcl
@@ -102,7 +102,7 @@ foreach {chars digit} {abc 2 def 3 ghi 4 jkl 5 mno 6 pqrs 7 tuv 8 wxyz 9} {
proc validatePhoneChange {W vmode idx char} {
global phoneNumberMap entry3content
- if {$idx == -1} {return 1}
+ if {$idx < 0} {return 1}
after idle [list $W configure -validate $vmode -invcmd bell]
if {
!($idx<3 || $idx==6 || $idx==7 || $idx==11 || $idx>15) &&
diff --git a/library/demos/floor.tcl b/library/demos/floor.tcl
index b5d3c64..eb2ea7f 100644
--- a/library/demos/floor.tcl
+++ b/library/demos/floor.tcl
@@ -1359,8 +1359,13 @@ $c bind floor2 <Button-1> "floorDisplay $c 2"
$c bind floor3 <Button-1> "floorDisplay $c 3"
$c bind room <Enter> "newRoom $c"
$c bind room <Leave> {set currentRoom ""}
-bind $c <Button-2> "$c scan mark %x %y"
-bind $c <B2-Motion> "$c scan dragto %x %y"
+if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
+ bind $c <Button-3> "$c scan mark %x %y"
+ bind $c <B3-Motion> "$c scan dragto %x %y"
+} else {
+ bind $c <Button-2> "$c scan mark %x %y"
+ bind $c <B2-Motion> "$c scan dragto %x %y"
+}
bind $c <Destroy> "unset currentRoom"
set currentRoom ""
trace variable currentRoom w "roomChanged $c"
diff --git a/library/demos/fontchoose.tcl b/library/demos/fontchoose.tcl
index 8b34377..446ed34 100644
--- a/library/demos/fontchoose.tcl
+++ b/library/demos/fontchoose.tcl
@@ -55,10 +55,6 @@ grid $f.msg $f.vs -sticky news
grid $f.font - -sticky e
grid columnconfigure $f 0 -weight 1
grid rowconfigure $f 0 -weight 1
-bind $w <Visibility> {
- bind %W <Visibility> {}
- grid propagate %W.f 0
-}
## See Code / Dismiss buttons
set btns [addSeeDismiss $w.buttons $w]
@@ -67,3 +63,5 @@ grid $f -sticky news
grid $btns -sticky ew
grid columnconfigure $w 0 -weight 1
grid rowconfigure $w 0 -weight 1
+update idletasks
+grid propagate $f 0
diff --git a/library/demos/goldberg.tcl b/library/demos/goldberg.tcl
index 1cc52c6..14ddb0b 100644
--- a/library/demos/goldberg.tcl
+++ b/library/demos/goldberg.tcl
@@ -113,9 +113,9 @@ proc DoDisplay {w} {
DoCtrlFrame $w
DoDetailFrame $w
if {[tk windowingsystem] ne "aqua"} {
- ttk::button $w.show -text "\u00bb" -command [list ShowCtrl $w] -width 2
+ ttk::button $w.show -text "»" -command [list ShowCtrl $w] -width 2
} else {
- button $w.show -text "\u00bb" -command [list ShowCtrl $w] -width 2 -highlightbackground $C(bg)
+ button $w.show -text "»" -command [list ShowCtrl $w] -width 2 -highlightbackground $C(bg)
}
place $w.show -in $w.c -relx 1 -rely 0 -anchor ne
update
@@ -204,10 +204,10 @@ proc DoDetailFrame {w} {
proc ShowCtrl {w} {
if {[winfo ismapped $w.ctrl]} {
pack forget $w.ctrl
- $w.show config -text "\u00bb"
+ $w.show config -text "»"
} else {
pack $w.ctrl -side right -fill both -ipady 5
- $w.show config -text "\u00ab"
+ $w.show config -text "»"
}
}
diff --git a/library/demos/items.tcl b/library/demos/items.tcl
index 1370560..1297046 100644
--- a/library/demos/items.tcl
+++ b/library/demos/items.tcl
@@ -17,7 +17,7 @@ wm iconname $w "Items"
positionWindow $w
set c $w.frame.c
-label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Button-1 drag:\tmoves item under pointer.\n Button-2 drag:\trepositions view.\n Button-3 drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
+label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Left-Button drag:\tmoves item under pointer.\n Middle-Button drag:\trepositions view.\n Right-Button drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
pack $w.msg -side top
## See Code / Dismiss buttons
@@ -173,10 +173,17 @@ $c create text 28.5c 17.4c -text Scale: -anchor s
$c bind item <Enter> "itemEnter $c"
$c bind item <Leave> "itemLeave $c"
-bind $c <Button-2> "$c scan mark %x %y"
-bind $c <B2-Motion> "$c scan dragto %x %y"
-bind $c <Button-3> "itemMark $c %x %y"
-bind $c <B3-Motion> "itemStroke $c %x %y"
+if {[tk windowingsystem] eq "aqua" && ![package vsatisfies [package provide Tk] 8.7-]} {
+ bind $c <Button-2> "itemMark $c %x %y"
+ bind $c <B2-Motion> "itemStroke $c %x %y"
+ bind $c <Button-3> "$c scan mark %x %y"
+ bind $c <B3-Motion> "$c scan dragto %x %y"
+} else {
+ bind $c <Button-2> "$c scan mark %x %y"
+ bind $c <B2-Motion> "$c scan dragto %x %y"
+ bind $c <Button-3> "itemMark $c %x %y"
+ bind $c <B3-Motion> "itemStroke $c %x %y"
+}
bind $c <<NextChar>> "itemsUnderArea $c"
bind $c <Button-1> "itemStartDrag $c %x %y"
bind $c <B1-Motion> "itemDrag $c %x %y"
@@ -250,14 +257,14 @@ proc itemsUnderArea {c} {
set area [$c find withtag area]
set items ""
foreach i [$c find enclosed $areaX1 $areaY1 $areaX2 $areaY2] {
- if {[lsearch [$c gettags $i] item] != -1} {
+ if {[lsearch [$c gettags $i] item] >= 0} {
lappend items $i
}
}
puts stdout "Items enclosed by area: $items"
set items ""
foreach i [$c find overlapping $areaX1 $areaY1 $areaX2 $areaY2] {
- if {[lsearch [$c gettags $i] item] != -1} {
+ if {[lsearch [$c gettags $i] item] >= 0} {
lappend items $i
}
}
diff --git a/library/demos/ixset b/library/demos/ixset
index b2b3252..85664d9 100644
--- a/library/demos/ixset
+++ b/library/demos/ixset
@@ -54,7 +54,7 @@ proc readsettings {} {
global screencyc ; set screencyc 600
set xfd [open "|xset q" r]
- while {[gets $xfd line] > -1} {
+ while {[gets $xfd line] >= 0} {
switch -- [lindex $line 0] {
auto {
set rpt [lindex $line 1]
diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl
index b5cffa8..09ceff0 100644
--- a/library/demos/knightstour.tcl
+++ b/library/demos/knightstour.tcl
@@ -1,4 +1,4 @@
-# Copyright (C) 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
+# Copyright © 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
#
# Calculate a Knight's tour of a chessboard.
#
@@ -21,7 +21,7 @@
# If you let it repeat then it will choose random start positions
# for each new tour.
-package require Tk 8.5
+package require Tk
# Return a list of accessible squares from a given square
proc ValidMoves {square} {
@@ -29,7 +29,7 @@ proc ValidMoves {square} {
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 > -1 && $row < 8 && $col > -1 && $col < 8} {
+ if {$row >= 0 && $row < 8 && $col >= 0 && $col < 8} {
lappend moves [expr {$row * 8 + $col}]
}
}
@@ -41,7 +41,7 @@ proc CheckSquare {square} {
variable visited
set moves 0
foreach test [ValidMoves $square] {
- if {[lsearch -exact -integer $visited $test] == -1} {
+ if {[lsearch -exact -integer $visited $test] < 0} {
incr moves
}
}
@@ -55,7 +55,7 @@ proc Next {square} {
set minimum 9
set nextSquare -1
foreach testSquare [ValidMoves $square] {
- if {[lsearch -exact -integer $visited $testSquare] == -1} {
+ if {[lsearch -exact -integer $visited $testSquare] < 0} {
set count [CheckSquare $testSquare]
if {$count < $minimum} {
set minimum $count
@@ -190,7 +190,7 @@ proc CreateGUI {} {
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 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
@@ -205,10 +205,10 @@ proc CreateGUI {} {
}
if {[tk windowingsystem] ne "x11"} {
catch {eval font create KnightFont -size -24}
- $c create text 0 0 -font KnightFont -text "\u265e" \
+ $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 \u265e glyph is available
+ # 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
diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl
index abe70a3..a76bd54 100644
--- a/library/demos/menu.tcl
+++ b/library/demos/menu.tcl
@@ -63,7 +63,7 @@ if {[tk windowingsystem] eq "aqua"} {
}
foreach i {A B C D E F} {
$m add command -label "Print letter \"$i\"" -underline 14 \
- -accelerator Meta+$i -command "puts $i" -accelerator $modifier+$i
+ -accelerator $modifier+$i -command "puts $i"
bind $w <$modifier-[string tolower $i]> "puts $i"
}
diff --git a/library/demos/pendulum.tcl b/library/demos/pendulum.tcl
index 9833e8f..04f276b 100644
--- a/library/demos/pendulum.tcl
+++ b/library/demos/pendulum.tcl
@@ -50,8 +50,8 @@ for {set i 90} {$i>=0} {incr i -10} {
$w.k create line 0 0 1 1 -smooth true -tags graph$i -fill grey$i
}
-$w.k create text 0 0 -anchor ne -text "\u03b8" -tags label_theta
-$w.k create text 0 0 -anchor ne -text "\u03b4\u03b8" -tags label_dtheta
+$w.k create text 0 0 -anchor ne -text "θ" -tags label_theta
+$w.k create text 0 0 -anchor ne -text "δθ" -tags label_dtheta
pack $w.k -in $w.p.l2 -fill both -expand true
# Initialize some variables
diff --git a/library/demos/tclIndex b/library/demos/tclIndex
index 86a72e2..cdb2f2c 100644
--- a/library/demos/tclIndex
+++ b/library/demos/tclIndex
@@ -6,62 +6,62 @@
# element name is the name of a command and the value is
# a script that loads the command.
-set auto_index(arrowSetup) [list source [file join $dir arrow.tcl]]
-set auto_index(arrowMove1) [list source [file join $dir arrow.tcl]]
-set auto_index(arrowMove2) [list source [file join $dir arrow.tcl]]
-set auto_index(arrowMove3) [list source [file join $dir arrow.tcl]]
-set auto_index(textLoadFile) [list source [file join $dir search.tcl]]
-set auto_index(textSearch) [list source [file join $dir search.tcl]]
-set auto_index(textToggle) [list source [file join $dir search.tcl]]
-set auto_index(itemEnter) [list source [file join $dir items.tcl]]
-set auto_index(itemLeave) [list source [file join $dir items.tcl]]
-set auto_index(itemMark) [list source [file join $dir items.tcl]]
-set auto_index(itemStroke) [list source [file join $dir items.tcl]]
-set auto_index(itemsUnderArea) [list source [file join $dir items.tcl]]
-set auto_index(itemStartDrag) [list source [file join $dir items.tcl]]
-set auto_index(itemDrag) [list source [file join $dir items.tcl]]
-set auto_index(butPress) [list source [file join $dir items.tcl]]
-set auto_index(loadDir) [list source [file join $dir image2.tcl]]
-set auto_index(loadImage) [list source [file join $dir image2.tcl]]
-set auto_index(rulerMkTab) [list source [file join $dir ruler.tcl]]
-set auto_index(rulerNewTab) [list source [file join $dir ruler.tcl]]
-set auto_index(rulerSelectTab) [list source [file join $dir ruler.tcl]]
-set auto_index(rulerMoveTab) [list source [file join $dir ruler.tcl]]
-set auto_index(rulerReleaseTab) [list source [file join $dir ruler.tcl]]
-set auto_index(mkTextConfig) [list source [file join $dir ctext.tcl]]
-set auto_index(textEnter) [list source [file join $dir ctext.tcl]]
-set auto_index(textInsert) [list source [file join $dir ctext.tcl]]
-set auto_index(textPaste) [list source [file join $dir ctext.tcl]]
-set auto_index(textB1Press) [list source [file join $dir ctext.tcl]]
-set auto_index(textB1Move) [list source [file join $dir ctext.tcl]]
-set auto_index(textBs) [list source [file join $dir ctext.tcl]]
-set auto_index(textDel) [list source [file join $dir ctext.tcl]]
-set auto_index(bitmapRow) [list source [file join $dir bitmap.tcl]]
-set auto_index(scrollEnter) [list source [file join $dir cscroll.tcl]]
-set auto_index(scrollLeave) [list source [file join $dir cscroll.tcl]]
-set auto_index(scrollButton) [list source [file join $dir cscroll.tcl]]
-set auto_index(textWindOn) [list source [file join $dir twind.tcl]]
-set auto_index(textWindOff) [list source [file join $dir twind.tcl]]
-set auto_index(textWindPlot) [list source [file join $dir twind.tcl]]
-set auto_index(embPlotDown) [list source [file join $dir twind.tcl]]
-set auto_index(embPlotMove) [list source [file join $dir twind.tcl]]
-set auto_index(textWindDel) [list source [file join $dir twind.tcl]]
-set auto_index(embDefBg) [list source [file join $dir twind.tcl]]
-set auto_index(floorDisplay) [list source [file join $dir floor.tcl]]
-set auto_index(newRoom) [list source [file join $dir floor.tcl]]
-set auto_index(roomChanged) [list source [file join $dir floor.tcl]]
-set auto_index(bg1) [list source [file join $dir floor.tcl]]
-set auto_index(bg2) [list source [file join $dir floor.tcl]]
-set auto_index(bg3) [list source [file join $dir floor.tcl]]
-set auto_index(fg1) [list source [file join $dir floor.tcl]]
-set auto_index(fg2) [list source [file join $dir floor.tcl]]
-set auto_index(fg3) [list source [file join $dir floor.tcl]]
-set auto_index(setWidth) [list source [file join $dir hscale.tcl]]
-set auto_index(plotDown) [list source [file join $dir plot.tcl]]
-set auto_index(plotMove) [list source [file join $dir plot.tcl]]
-set auto_index(puzzleSwitch) [list source [file join $dir puzzle.tcl]]
-set auto_index(setHeight) [list source [file join $dir vscale.tcl]]
-set auto_index(showMessageBox) [list source [file join $dir msgbox.tcl]]
-set auto_index(setColor) [list source [file join $dir clrpick.tcl]]
-set auto_index(setColor_helper) [list source [file join $dir clrpick.tcl]]
-set auto_index(fileDialog) [list source [file join $dir filebox.tcl]]
+set auto_index(arrowSetup) [list source -encoding utf-8 [file join $dir arrow.tcl]]
+set auto_index(arrowMove1) [list source -encoding utf-8 [file join $dir arrow.tcl]]
+set auto_index(arrowMove2) [list source -encoding utf-8 [file join $dir arrow.tcl]]
+set auto_index(arrowMove3) [list source -encoding utf-8 [file join $dir arrow.tcl]]
+set auto_index(textLoadFile) [list source -encoding utf-8 [file join $dir search.tcl]]
+set auto_index(textSearch) [list source -encoding utf-8 [file join $dir search.tcl]]
+set auto_index(textToggle) [list source -encoding utf-8 [file join $dir search.tcl]]
+set auto_index(itemEnter) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemLeave) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemMark) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemStroke) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemsUnderArea) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemStartDrag) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(itemDrag) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(butPress) [list source -encoding utf-8 [file join $dir items.tcl]]
+set auto_index(loadDir) [list source -encoding utf-8 [file join $dir image2.tcl]]
+set auto_index(loadImage) [list source -encoding utf-8 [file join $dir image2.tcl]]
+set auto_index(rulerMkTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(rulerNewTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(rulerSelectTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(rulerMoveTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(rulerReleaseTab) [list source -encoding utf-8 [file join $dir ruler.tcl]]
+set auto_index(mkTextConfig) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textEnter) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textInsert) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textPaste) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textB1Press) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textB1Move) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textBs) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(textDel) [list source -encoding utf-8 [file join $dir ctext.tcl]]
+set auto_index(bitmapRow) [list source -encoding utf-8 [file join $dir bitmap.tcl]]
+set auto_index(scrollEnter) [list source -encoding utf-8 [file join $dir cscroll.tcl]]
+set auto_index(scrollLeave) [list source -encoding utf-8 [file join $dir cscroll.tcl]]
+set auto_index(scrollButton) [list source -encoding utf-8 [file join $dir cscroll.tcl]]
+set auto_index(textWindOn) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(textWindOff) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(textWindPlot) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(embPlotDown) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(embPlotMove) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(textWindDel) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(embDefBg) [list source -encoding utf-8 [file join $dir twind.tcl]]
+set auto_index(floorDisplay) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(newRoom) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(roomChanged) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(bg1) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(bg2) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(bg3) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(fg1) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(fg2) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(fg3) [list source -encoding utf-8 [file join $dir floor.tcl]]
+set auto_index(setWidth) [list source -encoding utf-8 [file join $dir hscale.tcl]]
+set auto_index(plotDown) [list source -encoding utf-8 [file join $dir plot.tcl]]
+set auto_index(plotMove) [list source -encoding utf-8 [file join $dir plot.tcl]]
+set auto_index(puzzleSwitch) [list source -encoding utf-8 [file join $dir puzzle.tcl]]
+set auto_index(setHeight) [list source -encoding utf-8 [file join $dir vscale.tcl]]
+set auto_index(showMessageBox) [list source -encoding utf-8 [file join $dir msgbox.tcl]]
+set auto_index(setColor) [list source -encoding utf-8 [file join $dir clrpick.tcl]]
+set auto_index(setColor_helper) [list source -encoding utf-8 [file join $dir clrpick.tcl]]
+set auto_index(fileDialog) [list source -encoding utf-8 [file join $dir filebox.tcl]]
diff --git a/library/demos/tcolor b/library/demos/tcolor
index 64e1a53..0aa133b 100644
--- a/library/demos/tcolor
+++ b/library/demos/tcolor
@@ -7,7 +7,7 @@ exec wish "$0" ${1+"$@"}
# create colors using either the RGB, HSB, or CYM color spaces
# and apply the color to existing applications.
-package require Tk 8.4
+package require Tk
wm title . "Color Editor"
# Global variables that control the program:
diff --git a/library/demos/toolbar.tcl b/library/demos/toolbar.tcl
index cb2a495..a53e390 100644
--- a/library/demos/toolbar.tcl
+++ b/library/demos/toolbar.tcl
@@ -17,7 +17,7 @@ positionWindow $w
ttk::label $w.msg -wraplength 4i -text "This is a demonstration of how to do\
a toolbar that is styled correctly and which can be torn off. The\
- buttons are configured to be \u201Ctoolbar style\u201D buttons by\
+ buttons are configured to be “toolbar style” buttons by\
telling them that they are to use the Toolbutton style. At the left\
end of the toolbar is a simple marker that the cursor changes to a\
movement icon over; drag that away from the toolbar to tear off the\
diff --git a/library/demos/ttkbut.tcl b/library/demos/ttkbut.tcl
index ab49cf4..f6d94ac 100644
--- a/library/demos/ttkbut.tcl
+++ b/library/demos/ttkbut.tcl
@@ -17,7 +17,7 @@ wm title $w "Simple Ttk Widgets"
wm iconname $w "ttkbut"
positionWindow $w
-ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Ttk is the new Tk themed widget set. This is a Ttk themed label, and below are three groups of Ttk widgets in Ttk labelframes. The first group are all buttons that set the current application theme when pressed. The second group contains three sets of checkbuttons, with a separator widget between the sets. Note that the \u201cEnabled\u201d button controls whether all the other themed widgets in this toplevel are in the disabled state. The third group has a collection of linked radiobuttons."
+ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Ttk is the new Tk themed widget set. This is a Ttk themed label, and below are three groups of Ttk widgets in Ttk labelframes. The first group are all buttons that set the current application theme when pressed. The second group contains three sets of checkbuttons, with a separator widget between the sets. Note that the “Enabled” button controls whether all the other themed widgets in this toplevel are in the disabled state. The third group has a collection of linked radiobuttons."
pack $w.msg -side top -fill x
## See Code / Dismiss
diff --git a/library/demos/ttkprogress.tcl b/library/demos/ttkprogress.tcl
index 8a72cf9..29ac508 100644
--- a/library/demos/ttkprogress.tcl
+++ b/library/demos/ttkprogress.tcl
@@ -15,7 +15,7 @@ wm title $w "Progress Bar Demonstration"
wm iconname $w "ttkprogress"
positionWindow $w
-ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Below are two progress bars. The top one is a \u201Cdeterminate\u201D progress bar, which is used for showing how far through a defined task the program has got. The bottom one is an \u201Cindeterminate\u201D progress bar, which is used to show that the program is busy but does not know how long for. Both are run here in self-animated mode, which can be turned on and off using the buttons underneath."
+ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Below are two progress bars. The top one is a “determinate” progress bar, which is used for showing how far through a defined task the program has got. The bottom one is an “indeterminate” progress bar, which is used to show that the program is busy but does not know how long for. Both are run here in self-animated mode, which can be turned on and off using the buttons underneath."
pack $w.msg -side top -fill x
## See Code / Dismiss buttons
diff --git a/library/demos/unicodeout.tcl b/library/demos/unicodeout.tcl
index ca325a4..1ecc064 100644
--- a/library/demos/unicodeout.tcl
+++ b/library/demos/unicodeout.tcl
@@ -21,9 +21,7 @@ label $w.msg -font $font -wraplength 4i -anchor w -justify left \
non-Western character sets. However, what you will actually see\
below depends largely on what character sets you have installed,\
and what you see for characters that are not present varies greatly\
- between platforms as well. The strings are written in Tcl using\
- UNICODE characters using the \\uXXXX (or \\UXXXXXX) escape so as to\
- do so in a portable fashion."
+ between platforms as well."
pack $w.msg -side top
## See Code / Dismiss buttons
@@ -98,47 +96,29 @@ update
## Add the samples...
if {[usePresentationFormsFor Arabic]} {
# Using presentation forms (pre-layouted)
- addSample $w Arabic \
- "\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D " \
- "\uFE94\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D"
+ addSample $w Arabic "ﺔﻴﺑﺮﻌﻟﺍ ﺔﻤﻠﻜﻟﺍ"
} else {
# Using standard text characters
- addSample $w Arabic \
- "\u0627\u0644\u0643\u0644\u0645\u0629 " \
- "\u0627\u0644\u0639\u0631\u0628\u064A\u0629"
+ addSample $w Arabic "الكلمة العربية"
}
-addSample $w "Trad. Chinese" "\u4E2D\u570B\u7684\u6F22\u5B57"
-addSample $w "Simpl. Chinese" "\u6C49\u8BED"
-addSample $w French "Langue fran\xE7aise"
-addSample $w Greek \
- "\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE " \
- "\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1"
+addSample $w "Trad. Chinese" "中國的漢字"
+addSample $w "Simpl. Chinese" "汉语"
+addSample $w French "Langue française"
+addSample $w Greek "Ελληνική γλώσσα"
if {[usePresentationFormsFor Hebrew]} {
# Visual order (pre-layouted)
- addSample $w Hebrew \
- "\u05EA\u05D9\u05E8\u05D1\u05E2 \u05D1\u05EA\u05DB"
+ addSample $w Hebrew "תירבע בתכ"
} else {
# Standard logical order
- addSample $w Hebrew \
- "\u05DB\u05EA\u05D1 \u05E2\u05D1\u05E8\u05D9\u05EA"
+ addSample $w Hebrew "כתב עברית"
}
-addSample $w Hindi \
- "\u0939\u093F\u0928\u094D\u0926\u0940 \u092D\u093E\u0937\u093E"
-addSample $w Icelandic "\xCDslenska"
-addSample $w Japanese \
- "\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \
- "\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA"
-addSample $w Korean "\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00"
-addSample $w Russian \
- "\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u044F\u0437\u044B\u043A"
+addSample $w Hindi "हिन्दी भाषा"
+addSample $w Icelandic "Íslenska"
+addSample $w Japanese "日本語のひらがな, 漢字とカタカナ"
+addSample $w Korean "대한민국의 한글"
+addSample $w Russian "Русский язык"
if {([tk windowingsystem] ne "x11") || (![catch {tk::pkgconfig get fontsystem} fs] && ($fs eq "xft"))} {
- if {[package vsatisfies [package provide Tcl] 8.7-]} {
- addSample $w Emoji \
- "\U1F600\U1F4A9\U1F44D\U1F1F3\U1F1F1"
- } else {
- addSample $w Emoji \
- "\uD83D\uDE00\uD83D\uDCA9\uD83D\uDC4D\uD83C\uDDF3\uD83C\uDDF1"
- }
+ addSample $w Emoji "😀💩👍🇳🇱"
}
## We're done processing, so change things back to normal running...
diff --git a/library/demos/widget b/library/demos/widget
index e543846..4f7f715 100644
--- a/library/demos/widget
+++ b/library/demos/widget
@@ -516,7 +516,7 @@ proc invoke index {
.t configure -cursor [::ttk::cursor busy]
update
set demo [string range [lindex $tags $i] 5 end]
- uplevel 1 [list source [file join $tk_demoDirectory $demo.tcl]]
+ uplevel 1 [list source -encoding utf-8 [file join $tk_demoDirectory $demo.tcl]]
update
.t configure -cursor $cursor
@@ -624,6 +624,7 @@ proc showCode w {
wm title $top [mc "Demo code: %s" [file join $tk_demoDirectory $file]]
wm iconname $top $file
set id [open [file join $tk_demoDirectory $file]]
+ fconfigure $id -encoding utf-8 -eofchar \032
$top.f.text delete 1.0 end
$top.f.text insert 1.0 [read $id]
$top.f.text mark set insert 1.0
@@ -722,10 +723,10 @@ proc PrintTextWin32 {filename} {
proc tkAboutDialog {} {
tk_messageBox -icon info -type ok -title [mc "About Widget Demo"] \
-message [mc "Tk widget demonstration application"] -detail \
-"[mc "Copyright \u00a9 %s" {1996-1997 Sun Microsystems, Inc.}]
-[mc "Copyright \u00a9 %s" {1997-2000 Ajuba Solutions, Inc.}]
-[mc "Copyright \u00a9 %s" {2001-2009 Donal K. Fellows}]
-[mc "Copyright \u00a9 %s" {2002-2007 Daniel A. Steffen}]"
+"[mc "Copyright © %s" {1996-1997 Sun Microsystems, Inc.}]
+[mc "Copyright © %s" {1997-2000 Ajuba Solutions, Inc.}]
+[mc "Copyright © %s" {2001-2009 Donal K. Fellows}]
+[mc "Copyright © %s" {2002-2007 Daniel A. Steffen}]"
}
# Local Variables: