summaryrefslogtreecommitdiffstats
path: root/library/demos
diff options
context:
space:
mode:
Diffstat (limited to 'library/demos')
-rw-r--r--library/demos/combo.tcl3
-rw-r--r--library/demos/ctext.tcl63
-rw-r--r--library/demos/en.msg2
-rw-r--r--library/demos/filebox.tcl17
-rw-r--r--library/demos/fontchoose.tcl71
-rw-r--r--library/demos/hello4
-rw-r--r--library/demos/image2.tcl4
-rw-r--r--library/demos/images/face.xbm173
-rw-r--r--library/demos/images/ouster.pngbin0 -> 54257 bytes
-rw-r--r--library/demos/items.tcl27
-rw-r--r--library/demos/knightstour.tcl29
-rw-r--r--library/demos/label.tcl13
-rw-r--r--library/demos/mclist.tcl49
-rw-r--r--library/demos/msgbox.tcl3
-rw-r--r--library/demos/nl.msg2
-rw-r--r--library/demos/pendulum.tcl8
-rw-r--r--library/demos/rmt4
-rw-r--r--library/demos/square4
-rw-r--r--library/demos/tcolor4
-rw-r--r--library/demos/text.tcl29
-rw-r--r--library/demos/timer4
-rw-r--r--library/demos/toolbar.tcl3
-rw-r--r--library/demos/tree.tcl12
-rw-r--r--library/demos/ttkbut.tcl3
-rw-r--r--library/demos/ttkmenu.tcl3
-rw-r--r--library/demos/ttknote.tcl9
-rw-r--r--library/demos/ttkpane.tcl13
-rw-r--r--library/demos/ttkprogress.tcl3
-rw-r--r--library/demos/ttkscale.tcl2
-rw-r--r--library/demos/twind.tcl4
-rw-r--r--library/demos/unicodeout.tcl105
-rw-r--r--library/demos/widget29
32 files changed, 346 insertions, 353 deletions
diff --git a/library/demos/combo.tcl b/library/demos/combo.tcl
index 521e37b..2545d8b 100644
--- a/library/demos/combo.tcl
+++ b/library/demos/combo.tcl
@@ -2,14 +2,13 @@
#
# This demonstration script creates several combobox widgets.
#
-# RCS: @(#) $Id: combo.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: combo.tcl,v 1.4 2008/12/11 18:13:08 jenglish Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
package require Tk
-package require Ttk
set w .combo
catch {destroy $w}
diff --git a/library/demos/ctext.tcl b/library/demos/ctext.tcl
index 679dcc4..6bfe2be 100644
--- a/library/demos/ctext.tcl
+++ b/library/demos/ctext.tcl
@@ -3,7 +3,7 @@
# This demonstration script creates a canvas widget with a text
# item that can be edited and reconfigured in various ways.
#
-# RCS: @(#) $Id: ctext.tcl,v 1.5.4.1 2009/10/27 14:02:58 dkf Exp $
+# RCS: @(#) $Id: ctext.tcl,v 1.7 2009/10/27 14:02:17 dkf Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -19,7 +19,7 @@ wm iconname $w "Text"
positionWindow $w
set c $w.c
-label $w.msg -font $font -wraplength 5i -justify left -text "This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification. The text also supports the following simple bindings for editing:
+label $w.msg -font $font -wraplength 5i -justify left -text "This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adjust the position of the text relative to its positioning point or change its justification, and on a pie slice to change its angle. The text also supports the following simple bindings for editing:
1. You can point, click, and type.
2. You can also select with button 1.
3. You can copy the selection to the mouse position with button 2.
@@ -52,36 +52,63 @@ $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 <2> "textPaste $c @%x,%y"
+$c bind text <2> "textPaste $c @%x,%y"
# Next, create some items that allow the text's anchor position
# to be edited.
-proc mkTextConfig {w x y option value color} {
+proc mkTextConfigBox {w x y option value color} {
set item [$w create rect $x $y [expr {$x+30}] [expr {$y+30}] \
-outline black -fill $color -width 1]
$w bind $item <1> "$w itemconf text $option $value"
$w addtag config withtag $item
}
+proc mkTextConfigPie {w x y a option value color} {
+ set item [$w create arc $x $y [expr {$x+90}] [expr {$y+90}] \
+ -start [expr {$a-15}] -extent 30 -outline black -fill $color \
+ -width 1]
+ $w bind $item <1> "$w itemconf text $option $value"
+ $w addtag config withtag $item
+}
set x 50
set y 50
set color LightSkyBlue1
-mkTextConfig $c $x $y -anchor se $color
-mkTextConfig $c [expr {$x+30}] [expr {$y }] -anchor s $color
-mkTextConfig $c [expr {$x+60}] [expr {$y }] -anchor sw $color
-mkTextConfig $c [expr {$x }] [expr {$y+30}] -anchor e $color
-mkTextConfig $c [expr {$x+30}] [expr {$y+30}] -anchor center $color
-mkTextConfig $c [expr {$x+60}] [expr {$y+30}] -anchor w $color
-mkTextConfig $c [expr {$x }] [expr {$y+60}] -anchor ne $color
-mkTextConfig $c [expr {$x+30}] [expr {$y+60}] -anchor n $color
-mkTextConfig $c [expr {$x+60}] [expr {$y+60}] -anchor nw $color
+mkTextConfigBox $c $x $y -anchor se $color
+mkTextConfigBox $c [expr {$x+30}] [expr {$y }] -anchor s $color
+mkTextConfigBox $c [expr {$x+60}] [expr {$y }] -anchor sw $color
+mkTextConfigBox $c [expr {$x }] [expr {$y+30}] -anchor e $color
+mkTextConfigBox $c [expr {$x+30}] [expr {$y+30}] -anchor center $color
+mkTextConfigBox $c [expr {$x+60}] [expr {$y+30}] -anchor w $color
+mkTextConfigBox $c [expr {$x }] [expr {$y+60}] -anchor ne $color
+mkTextConfigBox $c [expr {$x+30}] [expr {$y+60}] -anchor n $color
+mkTextConfigBox $c [expr {$x+60}] [expr {$y+60}] -anchor nw $color
set item [$c create rect \
[expr {$x+40}] [expr {$y+40}] [expr {$x+50}] [expr {$y+50}] \
-outline black -fill red]
$c bind $item <1> "$c itemconf text -anchor center"
$c create text [expr {$x+45}] [expr {$y-5}] \
- -text {Text Position} -anchor s -font {Times 24} -fill brown
+ -text {Text Position} -anchor s -font {Times 20} -fill brown
+
+# Now create some items that allow the text's angle to be changed.
+
+set x 205
+set y 50
+set color Yellow
+mkTextConfigPie $c $x $y 0 -angle 90 $color
+mkTextConfigPie $c $x $y 30 -angle 120 $color
+mkTextConfigPie $c $x $y 60 -angle 150 $color
+mkTextConfigPie $c $x $y 90 -angle 180 $color
+mkTextConfigPie $c $x $y 120 -angle 210 $color
+mkTextConfigPie $c $x $y 150 -angle 240 $color
+mkTextConfigPie $c $x $y 180 -angle 270 $color
+mkTextConfigPie $c $x $y 210 -angle 300 $color
+mkTextConfigPie $c $x $y 240 -angle 330 $color
+mkTextConfigPie $c $x $y 270 -angle 0 $color
+mkTextConfigPie $c $x $y 300 -angle 30 $color
+mkTextConfigPie $c $x $y 330 -angle 60 $color
+$c create text [expr {$x+45}] [expr {$y-5}] \
+ -text {Text Angle} -anchor s -font {Times 20} -fill brown
# Lastly, create some items that allow the text's justification to be
# changed.
@@ -89,11 +116,11 @@ $c create text [expr {$x+45}] [expr {$y-5}] \
set x 350
set y 50
set color SeaGreen2
-mkTextConfig $c $x $y -justify left $color
-mkTextConfig $c [expr {$x+30}] $y -justify center $color
-mkTextConfig $c [expr {$x+60}] $y -justify right $color
+mkTextConfigBox $c $x $y -justify left $color
+mkTextConfigBox $c [expr {$x+30}] $y -justify center $color
+mkTextConfigBox $c [expr {$x+60}] $y -justify right $color
$c create text [expr {$x+45}] [expr {$y-5}] \
- -text {Justification} -anchor s -font {Times 24} -fill brown
+ -text {Justification} -anchor s -font {Times 20} -fill brown
$c bind config <Enter> "textEnter $c"
$c bind config <Leave> "$c itemconf current -fill \$textConfigFill"
diff --git a/library/demos/en.msg b/library/demos/en.msg
index d4783fe..e364c81 100644
--- a/library/demos/en.msg
+++ b/library/demos/en.msg
@@ -18,7 +18,7 @@
::msgcat::mcset en "Demo code: %s"
::msgcat::mcset en "About Widget Demo"
::msgcat::mcset en "Tk widget demonstration application"
-::msgcat::mcset en "Copyright (c) %s" "Copyright \u00a9 %s"
+::msgcat::mcset en "Copyright \u00a9 %s"
::msgcat::mcset en "
@@title
Tk Widget Demonstrations
diff --git a/library/demos/filebox.tcl b/library/demos/filebox.tcl
index e6088d8..445052e 100644
--- a/library/demos/filebox.tcl
+++ b/library/demos/filebox.tcl
@@ -2,7 +2,7 @@
#
# This demonstration script prompts the user to select a file.
#
-# RCS: @(#) $Id: filebox.tcl,v 1.9.2.1 2009/04/10 16:42:13 das Exp $
+# RCS: @(#) $Id: filebox.tcl,v 1.11 2010/01/04 12:11:48 patthoyts Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -17,7 +17,10 @@ wm title $w "File Selection Dialogs"
wm iconname $w "filebox"
positionWindow $w
-label $w.msg -font $font -wraplength 4i -justify left -text "Enter a file name in the entry box or click on the \"Browse\" buttons to select a file name using the file selection dialog."
+ttk::frame $w._bg
+place $w._bg -x 0 -y 0 -relwidth 1 -relheight 1
+
+ttk::label $w.msg -font $font -wraplength 4i -justify left -text "Enter a file name in the entry box or click on the \"Browse\" buttons to select a file name using the file selection dialog."
pack $w.msg -side top
## See Code / Dismiss buttons
@@ -25,10 +28,10 @@ set btns [addSeeDismiss $w.buttons $w]
pack $btns -side bottom -fill x
foreach i {open save} {
- set f [frame $w.$i]
- label $f.lab -text "Select a file to $i: " -anchor e
- entry $f.ent -width 20
- button $f.but -text "Browse ..." -command "fileDialog $w $f.ent $i"
+ set f [ttk::frame $w.$i]
+ ttk::label $f.lab -text "Select a file to $i: " -anchor e
+ ttk::entry $f.ent -width 20
+ ttk::button $f.but -text "Browse ..." -command "fileDialog $w $f.ent $i"
pack $f.lab -side left
pack $f.ent -side left -expand yes -fill x
pack $f.but -side left
@@ -36,7 +39,7 @@ foreach i {open save} {
}
if {[tk windowingsystem] eq "x11"} {
- checkbutton $w.strict -text "Use Motif Style Dialog" \
+ ttk::checkbutton $w.strict -text "Use Motif Style Dialog" \
-variable tk_strictMotif -onvalue 1 -offvalue 0
pack $w.strict -anchor c
diff --git a/library/demos/fontchoose.tcl b/library/demos/fontchoose.tcl
new file mode 100644
index 0000000..b67e17a
--- /dev/null
+++ b/library/demos/fontchoose.tcl
@@ -0,0 +1,71 @@
+# fontchoose.tcl --
+#
+# Show off the stock font selector dialog
+#
+# RCS: @(#) $Id: fontchoose.tcl,v 1.2 2010/01/04 12:09:36 patthoyts Exp $
+
+if {![info exists widgetDemo]} {
+ error "This script should be run from the \"widget\" demo."
+}
+
+package require Tk
+
+set w .fontchoose
+catch {destroy $w}
+toplevel $w
+wm title $w "Font Selection Dialog"
+wm iconname $w "fontchooser"
+positionWindow $w
+
+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
+ tk fontchooser show
+}
+
+proc ApplyFont {font} {
+ font configure FontchooseDemoFont {*}[font actual $font]
+}
+
+# When the visibility of the fontchooser changes, the following event is fired
+# to the parent widget.
+#
+bind $w <<TkFontchooserVisibility>> {
+ if {[tk fontchooser configure -visible]} {
+ %W.f.font state disabled
+ } else {
+ %W.f.font state !disabled
+ }
+}
+
+
+set f [ttk::frame $w.f -relief sunken -padding 2]
+
+text $f.msg -font FontchooseDemoFont -width 40 -height 6 -borderwidth 0 \
+ -yscrollcommand [list $f.vs set]
+ttk::scrollbar $f.vs -command [list $f.msg yview]
+
+$f.msg insert end "Press the buttons below to choose a new font for the\
+ text shown in this window.\n" {}
+
+ttk::button $f.font -text "Set font ..." -command [list SelectFont $w]
+
+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]
+
+grid $f -sticky news
+grid $btns -sticky ew
+grid columnconfigure $w 0 -weight 1
+grid rowconfigure $w 0 -weight 1
diff --git a/library/demos/hello b/library/demos/hello
index 6461f46..7c47669 100644
--- a/library/demos/hello
+++ b/library/demos/hello
@@ -1,12 +1,12 @@
#!/bin/sh
# the next line restarts using wish \
-exec wish "$0" "$@"
+exec wish "$0" ${1+"$@"}
# hello --
# Simple Tk script to create a button that prints "Hello, world".
# Click on the button to terminate the program.
#
-# RCS: @(#) $Id: hello,v 1.4 2003/09/30 14:54:30 dkf Exp $
+# RCS: @(#) $Id: hello,v 1.5 2009/03/25 23:27:09 nijtmans Exp $
package require Tk
diff --git a/library/demos/image2.tcl b/library/demos/image2.tcl
index 0444dd4..eed64ad 100644
--- a/library/demos/image2.tcl
+++ b/library/demos/image2.tcl
@@ -3,7 +3,7 @@
# This demonstration script creates a simple collection of widgets
# that allow you to select and view images in a Tk label.
#
-# RCS: @(#) $Id: image2.tcl,v 1.11 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: image2.tcl,v 1.12 2009/02/11 15:25:31 dkf Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -38,7 +38,7 @@ proc loadDir w {
proc selectAndLoadDir w {
global dirName
set dir [tk_chooseDirectory -initialdir $dirName -parent $w -mustexist 1]
- if {[string length $dir] != 0} {
+ if {$dir ne ""} {
set dirName $dir
loadDir $w
}
diff --git a/library/demos/images/face.xbm b/library/demos/images/face.xbm
deleted file mode 100644
index 03d829f..0000000
--- a/library/demos/images/face.xbm
+++ /dev/null
@@ -1,173 +0,0 @@
-#define face_width 108
-#define face_height 144
-#define face_x_hot 48
-#define face_y_hot 80
-static char face_bits[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x09,
- 0x20, 0x80, 0x24, 0x05, 0x00, 0x80, 0x08, 0x00, 0x00, 0x00, 0x00, 0x88,
- 0x24, 0x20, 0x80, 0x24, 0x00, 0x00, 0x00, 0x10, 0x80, 0x04, 0x00, 0x01,
- 0x00, 0x01, 0x40, 0x0a, 0x09, 0x00, 0x92, 0x04, 0x80, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x10, 0x40, 0x12, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x84,
- 0x24, 0x40, 0x22, 0xa8, 0x02, 0x14, 0x84, 0x92, 0x40, 0x42, 0x12, 0x04,
- 0x10, 0x00, 0x00, 0x00, 0x00, 0x52, 0x00, 0x52, 0x11, 0x00, 0x12, 0x00,
- 0x40, 0x02, 0x00, 0x20, 0x00, 0x08, 0x00, 0xaa, 0x02, 0x54, 0x85, 0x24,
- 0x00, 0x10, 0x12, 0x00, 0x00, 0x81, 0x44, 0x00, 0x90, 0x5a, 0x00, 0xea,
- 0x1b, 0x00, 0x80, 0x40, 0x40, 0x02, 0x00, 0x08, 0x00, 0x20, 0xa2, 0x05,
- 0x8a, 0xb4, 0x6e, 0x45, 0x12, 0x04, 0x08, 0x00, 0x00, 0x00, 0x10, 0x02,
- 0xa8, 0x92, 0x00, 0xda, 0x5f, 0x10, 0x00, 0x10, 0xa1, 0x04, 0x20, 0x41,
- 0x02, 0x00, 0x5a, 0x25, 0xa0, 0xff, 0xfb, 0x05, 0x41, 0x02, 0x04, 0x00,
- 0x00, 0x08, 0x40, 0x80, 0xec, 0x9b, 0xec, 0xfe, 0x7f, 0x01, 0x04, 0x20,
- 0x90, 0x02, 0x04, 0x00, 0x08, 0x20, 0xfb, 0x2e, 0xf5, 0xff, 0xff, 0x57,
- 0x00, 0x04, 0x02, 0x00, 0x00, 0x20, 0x01, 0xc1, 0x6e, 0xab, 0xfa, 0xff,
- 0xff, 0x05, 0x90, 0x20, 0x48, 0x02, 0x00, 0x04, 0x20, 0xa8, 0xdf, 0xb5,
- 0xfe, 0xff, 0xff, 0x0b, 0x01, 0x00, 0x01, 0x00, 0x80, 0x80, 0x04, 0xe0,
- 0xbb, 0xef, 0xff, 0xff, 0x7f, 0x01, 0x00, 0x04, 0x48, 0x02, 0x00, 0x20,
- 0x80, 0xf4, 0x6f, 0xfb, 0xff, 0xff, 0xff, 0x20, 0x90, 0x40, 0x02, 0x00,
- 0x00, 0x04, 0x08, 0xb8, 0xf6, 0xff, 0xff, 0xdf, 0xbe, 0x12, 0x45, 0x10,
- 0x90, 0x04, 0x90, 0x00, 0x22, 0xfa, 0xff, 0xff, 0xff, 0xbb, 0xd7, 0xe9,
- 0x3a, 0x02, 0x02, 0x00, 0x04, 0x90, 0x80, 0xfe, 0xdf, 0xf6, 0xb7, 0xef,
- 0xbe, 0x56, 0x57, 0x40, 0x48, 0x09, 0x00, 0x04, 0x00, 0xfa, 0xf5, 0xdf,
- 0xed, 0x5a, 0xd5, 0xea, 0xbd, 0x09, 0x00, 0x00, 0x40, 0x00, 0x92, 0xfe,
- 0xbf, 0x7d, 0xb7, 0x6a, 0x55, 0xbf, 0xf7, 0x02, 0x11, 0x01, 0x00, 0x91,
- 0x00, 0xff, 0xff, 0xaf, 0x55, 0x55, 0x5b, 0xeb, 0xef, 0x22, 0x04, 0x04,
- 0x04, 0x00, 0xa4, 0xff, 0xf7, 0xad, 0xaa, 0xaa, 0xaa, 0xbe, 0xfe, 0x03,
- 0x20, 0x00, 0x10, 0x44, 0x80, 0xff, 0x7f, 0x55, 0x12, 0x91, 0x2a, 0xeb,
- 0xbf, 0x0b, 0x82, 0x02, 0x00, 0x00, 0xd1, 0x7f, 0xdf, 0xa2, 0xa4, 0x54,
- 0x55, 0xfd, 0xfd, 0x47, 0x08, 0x08, 0x00, 0x21, 0xe4, 0xff, 0x37, 0x11,
- 0x09, 0xa5, 0xaa, 0xb6, 0xff, 0x0d, 0x80, 0x00, 0x00, 0x04, 0xd0, 0xff,
- 0x4f, 0x44, 0x20, 0x48, 0x55, 0xfb, 0xff, 0x27, 0x11, 0x02, 0x40, 0x40,
- 0xe2, 0xfb, 0x15, 0x11, 0x4a, 0x55, 0x4a, 0x7d, 0xf7, 0x0f, 0x00, 0x00,
- 0x04, 0x08, 0xf8, 0xdf, 0x52, 0x44, 0x01, 0x52, 0xb5, 0xfa, 0xff, 0x0f,
- 0x49, 0x02, 0x00, 0x02, 0xe9, 0xf6, 0x0a, 0x11, 0xa4, 0x88, 0x4a, 0x6d,
- 0xff, 0x5f, 0x00, 0x00, 0x10, 0x20, 0xf0, 0x2f, 0x21, 0x44, 0x10, 0x52,
- 0xb5, 0xfa, 0xff, 0x0f, 0x44, 0x04, 0x80, 0x08, 0xf8, 0xab, 0x8a, 0x00,
- 0x81, 0xa4, 0xd4, 0xd6, 0xfe, 0x2f, 0x00, 0x00, 0x04, 0x40, 0xb5, 0x2d,
- 0x21, 0x08, 0x04, 0x90, 0xaa, 0xfa, 0xff, 0x1f, 0x11, 0x01, 0x00, 0x04,
- 0xf0, 0x57, 0x0a, 0x22, 0x40, 0x4a, 0xda, 0x5e, 0xfb, 0x1f, 0x40, 0x00,
- 0x40, 0x20, 0xba, 0x95, 0x90, 0x00, 0x01, 0xa0, 0xaa, 0xea, 0xff, 0x5f,
- 0x02, 0x02, 0x00, 0x01, 0xe8, 0x57, 0x05, 0x00, 0x00, 0x12, 0xd5, 0xfe,
- 0xfd, 0x1f, 0x48, 0x00, 0x04, 0x48, 0x7a, 0x95, 0x08, 0x02, 0x10, 0x40,
- 0xaa, 0x55, 0xf7, 0x1f, 0x00, 0x09, 0x20, 0x00, 0xf8, 0x57, 0x22, 0x10,
- 0x00, 0x28, 0xa9, 0xfa, 0xff, 0x5f, 0x02, 0x00, 0x00, 0x49, 0xdd, 0x29,
- 0x01, 0x00, 0x80, 0x80, 0xaa, 0xd7, 0xff, 0x0f, 0x10, 0x00, 0x08, 0x00,
- 0xf8, 0x96, 0x08, 0x00, 0x00, 0x20, 0x54, 0xfa, 0xee, 0x3f, 0x81, 0x04,
- 0x40, 0x24, 0xfe, 0x55, 0x82, 0x00, 0x00, 0x82, 0xd2, 0xad, 0xff, 0x0f,
- 0x08, 0x00, 0x04, 0x80, 0x6c, 0x97, 0x00, 0x00, 0x02, 0x20, 0xa9, 0xf6,
- 0xdf, 0x5f, 0x00, 0x02, 0x20, 0x09, 0xfa, 0x49, 0x12, 0x00, 0x20, 0x84,
- 0x54, 0xdb, 0xfe, 0x1f, 0x91, 0x00, 0x00, 0x00, 0xf8, 0x2b, 0x00, 0x20,
- 0x00, 0x40, 0xa4, 0xf6, 0xbb, 0x1f, 0x04, 0x00, 0x44, 0x92, 0x7e, 0x95,
- 0x02, 0x00, 0x00, 0x89, 0xaa, 0xdd, 0xff, 0x1f, 0x20, 0x09, 0x10, 0x00,
- 0xf4, 0x57, 0x20, 0x01, 0x08, 0x20, 0xa9, 0x76, 0xff, 0x5f, 0x02, 0x00,
- 0x00, 0x21, 0xfc, 0x4a, 0x05, 0x00, 0x01, 0x80, 0x54, 0xdb, 0xff, 0x1e,
- 0x08, 0x02, 0x04, 0x08, 0xf9, 0x2b, 0x00, 0x00, 0x40, 0x28, 0xd2, 0xf6,
- 0xff, 0xbf, 0x80, 0x00, 0x90, 0x00, 0xbc, 0x92, 0x08, 0x10, 0x00, 0x82,
- 0x54, 0xdb, 0xff, 0x1f, 0x20, 0x00, 0x00, 0x44, 0xf9, 0x55, 0x02, 0x01,
- 0x00, 0x20, 0xaa, 0xbd, 0xfd, 0x3f, 0x08, 0x04, 0x04, 0x10, 0xf4, 0x2a,
- 0x01, 0x00, 0x22, 0x80, 0xd4, 0xf6, 0xff, 0x5f, 0x82, 0x00, 0x40, 0x02,
- 0xf8, 0x55, 0x20, 0x00, 0x00, 0x50, 0x6a, 0xdf, 0xfe, 0x3f, 0x00, 0x00,
- 0x00, 0x48, 0xe9, 0x4a, 0x05, 0x08, 0x00, 0xa5, 0xd5, 0xf5, 0xff, 0x3f,
- 0x10, 0x01, 0x10, 0x01, 0xb0, 0xab, 0x92, 0x02, 0x40, 0xf8, 0xbf, 0xde,
- 0xfe, 0x5f, 0x02, 0x04, 0x04, 0x48, 0xfa, 0xd4, 0x6f, 0x20, 0x84, 0xef,
- 0xff, 0xfb, 0xff, 0x1f, 0x20, 0x00, 0x00, 0x00, 0xe0, 0xed, 0xbf, 0x0b,
- 0xa1, 0x7e, 0xff, 0xbf, 0xfd, 0x5f, 0x04, 0x01, 0x20, 0x49, 0xd2, 0xfb,
- 0xfe, 0x55, 0xd4, 0xff, 0xff, 0xf6, 0xff, 0x07, 0x00, 0x04, 0x00, 0x00,
- 0xc0, 0xaa, 0xfb, 0x2b, 0xa2, 0xfe, 0xff, 0xdf, 0xee, 0x1f, 0x91, 0x00,
- 0x82, 0xa4, 0xa4, 0xf5, 0xff, 0x57, 0xd5, 0xff, 0xbf, 0xfd, 0xff, 0x4d,
- 0x00, 0x00, 0x20, 0x00, 0x88, 0x5b, 0xff, 0x2f, 0x69, 0xff, 0xff, 0xdb,
- 0xfe, 0x1f, 0x24, 0x02, 0x00, 0x49, 0xa2, 0xd6, 0xff, 0x5f, 0xea, 0xff,
- 0x7f, 0x7f, 0x7f, 0x0d, 0x00, 0x00, 0x10, 0x00, 0x40, 0xab, 0xf7, 0xbb,
- 0xf0, 0xdf, 0xff, 0xd5, 0xff, 0xbf, 0x82, 0x04, 0x42, 0x24, 0x91, 0xd5,
- 0xaa, 0xae, 0xd4, 0xaa, 0x52, 0x7b, 0xff, 0x15, 0x08, 0x00, 0x00, 0x01,
- 0x04, 0x55, 0xd5, 0x55, 0x70, 0x5b, 0x75, 0xdd, 0xdf, 0x1f, 0x40, 0x00,
- 0x08, 0x48, 0xa0, 0x4a, 0xa9, 0x56, 0xea, 0x56, 0xad, 0x6a, 0x7d, 0x9b,
- 0x04, 0x01, 0x00, 0x02, 0x42, 0x2a, 0xd5, 0xaa, 0xa8, 0xaa, 0xaa, 0xfa,
- 0xdf, 0x2f, 0x10, 0x04, 0x22, 0x48, 0x08, 0x45, 0x2a, 0x15, 0x68, 0x55,
- 0x55, 0xd7, 0x76, 0x1b, 0x00, 0x00, 0x00, 0x01, 0x40, 0x2a, 0x80, 0xa0,
- 0xb2, 0x09, 0x48, 0xb9, 0xdf, 0x17, 0x22, 0x01, 0x00, 0x24, 0x45, 0x8a,
- 0x24, 0x4a, 0x54, 0x51, 0x91, 0xf6, 0x6e, 0x4b, 0x00, 0x04, 0x90, 0x00,
- 0x80, 0x52, 0x00, 0x20, 0x69, 0x05, 0xa4, 0xaa, 0xff, 0x1e, 0x48, 0x00,
- 0x02, 0x92, 0x08, 0x05, 0x81, 0x94, 0xd4, 0x92, 0x40, 0xfd, 0xb6, 0x8b,
- 0x00, 0x01, 0x40, 0x00, 0x82, 0x54, 0x00, 0x48, 0x68, 0x05, 0x90, 0xa4,
- 0xef, 0x06, 0x24, 0x00, 0x08, 0x12, 0x10, 0x05, 0x00, 0x10, 0xb5, 0x01,
- 0x42, 0xfb, 0xbf, 0x43, 0x00, 0x09, 0x00, 0x40, 0x81, 0xa8, 0x08, 0x4a,
- 0xaa, 0x96, 0x90, 0xac, 0x6d, 0x15, 0x22, 0x00, 0x20, 0x09, 0x04, 0x15,
- 0x80, 0x28, 0xdc, 0x01, 0x24, 0xfb, 0xbf, 0x01, 0x80, 0x04, 0x09, 0x00,
- 0x40, 0x48, 0x02, 0x45, 0xb2, 0x2e, 0x41, 0x6d, 0xef, 0x05, 0x11, 0x00,
- 0x40, 0x52, 0x02, 0x15, 0x29, 0x2a, 0xac, 0x42, 0x54, 0xfb, 0x3b, 0x51,
- 0x84, 0x00, 0x08, 0x00, 0x20, 0x54, 0x80, 0x05, 0xb5, 0x3d, 0xa2, 0xb6,
- 0xdf, 0x00, 0x20, 0x04, 0x20, 0x49, 0x89, 0xa8, 0x6a, 0x29, 0xac, 0xd6,
- 0x54, 0xff, 0x3f, 0x84, 0x00, 0x01, 0x04, 0x10, 0x00, 0x94, 0xa8, 0x56,
- 0xda, 0x5f, 0xab, 0xd5, 0x1e, 0x10, 0x48, 0x00, 0x90, 0x82, 0x48, 0xa8,
- 0xb2, 0xac, 0xfd, 0x55, 0xd5, 0xfe, 0x9f, 0x80, 0x00, 0x0a, 0x02, 0x08,
- 0x02, 0x55, 0x5a, 0x75, 0xff, 0xaf, 0xb6, 0xf7, 0x2d, 0x12, 0x92, 0x00,
- 0x10, 0x20, 0x10, 0xa8, 0x54, 0xd5, 0xbf, 0x5d, 0xad, 0xdd, 0x0f, 0x00,
- 0x00, 0x04, 0x40, 0x09, 0x84, 0xa8, 0xaa, 0x5a, 0xed, 0xeb, 0x6a, 0xff,
- 0x9f, 0xa4, 0x24, 0x01, 0x02, 0xa0, 0x20, 0x50, 0x55, 0xd5, 0xbe, 0xae,
- 0xad, 0xfd, 0x16, 0x00, 0x10, 0x04, 0x20, 0x0a, 0x08, 0xb4, 0xaa, 0x95,
- 0xaa, 0x7b, 0xb7, 0xdb, 0x5f, 0x92, 0x04, 0x01, 0x84, 0x20, 0x21, 0x51,
- 0xd5, 0x2a, 0xa9, 0xee, 0xd5, 0xfe, 0x0d, 0x00, 0x20, 0x04, 0x10, 0x00,
- 0x08, 0x50, 0xe9, 0xd7, 0xd4, 0xfb, 0xb5, 0xff, 0x9f, 0x24, 0x09, 0x01,
- 0x42, 0x4a, 0xa2, 0x64, 0xd5, 0x55, 0x7b, 0x7f, 0xda, 0x7d, 0x4f, 0x00,
- 0x20, 0x04, 0x00, 0x80, 0x00, 0xa0, 0x2a, 0x13, 0x84, 0x6a, 0x55, 0xff,
- 0x1d, 0x48, 0x8a, 0x00, 0x94, 0x24, 0x8a, 0xc8, 0xaa, 0x42, 0x20, 0x5d,
- 0xf5, 0xff, 0x5f, 0x01, 0x00, 0x02, 0x01, 0x00, 0x20, 0xa2, 0x4a, 0x1a,
- 0x82, 0x56, 0xda, 0xbd, 0x3f, 0x92, 0x92, 0x00, 0x90, 0x92, 0x00, 0x40,
- 0x95, 0x6a, 0xf4, 0x55, 0x6d, 0xff, 0xd6, 0x00, 0x00, 0x0a, 0x04, 0x20,
- 0x14, 0x49, 0x4b, 0xaa, 0xaa, 0x56, 0xf5, 0xff, 0xbf, 0xab, 0xa4, 0x00,
- 0x20, 0x89, 0x40, 0x80, 0xaa, 0xaa, 0xaa, 0xaa, 0xde, 0xbf, 0xeb, 0x03,
- 0x00, 0x02, 0x04, 0x02, 0x0a, 0x10, 0x2b, 0x2a, 0x55, 0x5b, 0xf5, 0xff,
- 0xd7, 0x2f, 0x92, 0x00, 0x10, 0x28, 0x21, 0x01, 0x56, 0x95, 0xa0, 0x56,
- 0xdf, 0xef, 0xea, 0x87, 0x40, 0x0a, 0x42, 0x41, 0x00, 0x90, 0xaa, 0x52,
- 0xb6, 0xad, 0xfa, 0xff, 0xd5, 0x2f, 0x14, 0x00, 0x00, 0x04, 0x95, 0x04,
- 0xaa, 0xac, 0x55, 0x6b, 0xff, 0xb7, 0xea, 0x9f, 0x40, 0x02, 0x28, 0x51,
- 0x00, 0x40, 0x58, 0xd5, 0xda, 0xd6, 0x6e, 0x7f, 0xf9, 0x3f, 0x12, 0x04,
- 0x02, 0x04, 0x49, 0x25, 0x55, 0xaa, 0x77, 0xab, 0xff, 0x2b, 0xfd, 0x3f,
- 0x48, 0x01, 0x20, 0x41, 0x00, 0x00, 0x58, 0xa9, 0xda, 0xea, 0xfd, 0xaf,
- 0xfa, 0xff, 0x02, 0x04, 0x08, 0x14, 0x29, 0x49, 0x52, 0x55, 0x55, 0x55,
- 0xff, 0x8d, 0xfe, 0x3f, 0xa8, 0x00, 0x02, 0x41, 0x00, 0x02, 0xa0, 0xa2,
- 0xaa, 0xea, 0xff, 0x53, 0xfd, 0xff, 0x02, 0x04, 0x50, 0x04, 0x25, 0xa8,
- 0x54, 0x49, 0x52, 0xb5, 0xbf, 0x8a, 0xfe, 0xff, 0xa9, 0x08, 0x04, 0x50,
- 0x80, 0x02, 0xa1, 0x2a, 0x95, 0xea, 0xff, 0xa1, 0xff, 0xff, 0x03, 0x02,
- 0x90, 0x02, 0x09, 0x08, 0x44, 0x49, 0x52, 0xbd, 0x7f, 0xca, 0xff, 0xff,
- 0x2b, 0x09, 0x04, 0x48, 0x40, 0x82, 0x90, 0x56, 0xa9, 0xf6, 0xbf, 0xd0,
- 0xff, 0xff, 0x47, 0x00, 0x50, 0x02, 0x15, 0x11, 0x40, 0x95, 0xaa, 0xfd,
- 0x2f, 0xe9, 0xff, 0xff, 0x8f, 0x0a, 0x84, 0x50, 0x40, 0x84, 0x14, 0xaa,
- 0x6a, 0xff, 0x5f, 0xf2, 0xff, 0xff, 0x7f, 0x00, 0x10, 0x02, 0x09, 0x10,
- 0x40, 0x7d, 0xf7, 0xff, 0x0b, 0xfc, 0xff, 0xff, 0xaf, 0x02, 0x84, 0x50,
- 0x42, 0x85, 0x12, 0xd0, 0xdd, 0xff, 0xa7, 0xf2, 0xff, 0xff, 0xff, 0x04,
- 0x00, 0x0a, 0x08, 0x10, 0x48, 0xf8, 0xff, 0xff, 0x0a, 0xfe, 0xff, 0xff,
- 0x7f, 0x03, 0xa4, 0x80, 0xa2, 0x8a, 0x02, 0x68, 0xff, 0xff, 0x52, 0xfd,
- 0xff, 0xff, 0xff, 0x07, 0x00, 0x2a, 0x08, 0x20, 0x28, 0xdc, 0xff, 0x5f,
- 0x05, 0xff, 0xff, 0xff, 0xff, 0x0d, 0x92, 0x40, 0x22, 0x09, 0x02, 0xea,
- 0xfb, 0xaf, 0x48, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x12, 0x81, 0xa0,
- 0x48, 0x9c, 0x6e, 0x93, 0xa2, 0xff, 0xff, 0xff, 0xff, 0x07, 0xa8, 0x40,
- 0x28, 0x0a, 0x02, 0x74, 0xb5, 0x45, 0x81, 0xff, 0xff, 0xff, 0xff, 0x0f,
- 0x02, 0x0a, 0x81, 0x20, 0x08, 0xae, 0xaa, 0x90, 0xe8, 0xff, 0xff, 0xff,
- 0xff, 0x0f, 0x90, 0x40, 0x28, 0x88, 0x12, 0x58, 0x15, 0x50, 0xd0, 0xff,
- 0xff, 0xff, 0xff, 0x0f, 0x44, 0x0a, 0x41, 0x21, 0x08, 0xae, 0x04, 0x14,
- 0xf0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x10, 0x40, 0x14, 0x88, 0x04, 0xba,
- 0x02, 0x28, 0xe8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x42, 0x15, 0x41, 0x21,
- 0x05, 0xad, 0x00, 0x05, 0xf8, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x10, 0x40,
- 0x24, 0x8a, 0x0e, 0x36, 0x00, 0x0a, 0xf4, 0xff, 0xff, 0xff, 0xff, 0x0f,
- 0x42, 0x25, 0x90, 0xd0, 0x8b, 0xc2, 0x41, 0x05, 0xfc, 0xff, 0xff, 0xff,
- 0xff, 0x0f, 0x10, 0x08, 0x05, 0xe8, 0x8e, 0x58, 0x80, 0x02, 0xfa, 0xff,
- 0xff, 0xff, 0xff, 0x0f, 0x4a, 0x20, 0xa8, 0xba, 0x0b, 0x2b, 0x51, 0x01,
- 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x8a, 0x02, 0xe8, 0xaf, 0x84,
- 0x90, 0x04, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x52, 0x21, 0x54, 0xbf,
- 0x1f, 0x15, 0xa5, 0x02, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x08,
- 0x01, 0xfa, 0xb6, 0xa4, 0x52, 0x40, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
- 0x4a, 0xa2, 0x54, 0xef, 0x5f, 0x4b, 0xa4, 0x80, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0x0f, 0x80, 0x10, 0x82, 0xfe, 0xbf, 0x92, 0x52, 0x42, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0x0f, 0x12, 0x42, 0xa8, 0xbf, 0x1f, 0x24, 0x80, 0xa0,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x84, 0x28, 0x8a, 0xf7, 0x37, 0x80,
- 0x52, 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x10, 0x82, 0xe0, 0xff,
- 0x1f, 0x00, 0x20, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x84, 0x28,
- 0xca, 0xff, 0x1f, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f,
- 0x10, 0x42, 0xf0, 0xfd, 0x1b, 0x00, 0x50, 0xf0, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0x0f, 0xa4, 0x10, 0xc5, 0xff, 0x1f, 0x00, 0x00, 0xe0, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0x0f, 0x00, 0x22, 0xf8, 0xff, 0x0e, 0x00, 0x00, 0xf0,
- 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xaa, 0x88, 0xe2, 0xff, 0x0f, 0x10,
- 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x25, 0xfa, 0xff,
- 0x0f, 0x01, 0x11, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xfb,
- 0xfb, 0xff, 0x7f, 0x5d, 0xd5, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f};
diff --git a/library/demos/images/ouster.png b/library/demos/images/ouster.png
new file mode 100644
index 0000000..259b8f9
--- /dev/null
+++ b/library/demos/images/ouster.png
Binary files differ
diff --git a/library/demos/items.tcl b/library/demos/items.tcl
index 11aa32f..c665be2 100644
--- a/library/demos/items.tcl
+++ b/library/demos/items.tcl
@@ -3,7 +3,7 @@
# This demonstration script creates a canvas that displays the
# canvas item types.
#
-# RCS: @(#) $Id: items.tcl,v 1.7 2004/12/21 11:56:35 dkf Exp $
+# RCS: @(#) $Id: items.tcl,v 1.11 2010/01/04 22:13:59 patthoyts Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -128,8 +128,8 @@ $c create text 25.5c 11c -anchor w -font $font1 -fill $blue \
-text "Several lines,\n each centered\nindividually,\nand all anchored\nat the left edge." \
-justify center -tags item
$c create rectangle 24.9c 13.9c 25.1c 14.1c
-$c create text 25c 14c -font $font2 -anchor c -fill $red -stipple gray50 \
- -text "Stippled characters" -tags item
+$c create text 25c 14c -font $font2 -anchor c -fill $red -angle 15 \
+ -text "Angled characters" -tags item
$c create text 5c 16.2c -text Arcs -anchor n
$c create arc 0.5c 17c 7c 20c -fill $green -outline black \
@@ -142,9 +142,13 @@ $c create arc 0.5c 20c 9.5c 24c -width 4m -style pieslice \
$c create arc 5.5c 20.5c 9.5c 23.5c -width 4m -style chord \
-fill $blue -outline {} -start 45 -extent 270 -tags item
-$c create text 15c 16.2c -text Bitmaps -anchor n
-$c create bitmap 13c 20c -tags item \
- -bitmap @[file join $tk_demoDirectory images face.xbm]
+image create photo items.ousterhout \
+ -file [file join $tk_demoDirectory images ouster.png]
+image create photo items.ousterhout.active -format "png -alpha 0.5" \
+ -file [file join $tk_demoDirectory images ouster.png]
+$c create text 15c 16.2c -text "Bitmaps and Images" -anchor n
+$c create image 13c 20c -tags item -image items.ousterhout \
+ -activeimage items.ousterhout.active
$c create bitmap 17c 18.5c -tags item \
-bitmap @[file join $tk_demoDirectory images noletter.xbm]
$c create bitmap 17c 21.5c -tags item \
@@ -185,15 +189,18 @@ proc itemEnter {c} {
return
}
set type [$c type current]
- if {$type == "window"} {
+ if {$type == "window" || $type == "image"} {
set restoreCmd {}
return
- }
- if {$type == "bitmap"} {
+ } elseif {$type == "bitmap"} {
set bg [lindex [$c itemconf current -background] 4]
set restoreCmd [list $c itemconfig current -background $bg]
$c itemconfig current -background SteelBlue2
return
+ } elseif {$type == "image"} {
+ set restoreCmd [list $c itemconfig current -state normal]
+ $c itemconfig current -state active
+ return
}
set fill [lindex [$c itemconfig current -fill] 4]
if {(($type == "rectangle") || ($type == "oval") || ($type == "arc"))
@@ -281,6 +288,6 @@ proc itemDrag {c x y} {
# is invoked.
proc butPress {w color} {
- set i [$w create text 25c 18.1c -text "Ouch!!" -fill $color -anchor n]
+ set i [$w create text 25c 18.1c -text "Oooohhh!!" -fill $color -anchor n]
after 500 "$w delete $i"
}
diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl
index b52e38f..73ca3a3 100644
--- a/library/demos/knightstour.tcl
+++ b/library/demos/knightstour.tcl
@@ -61,6 +61,8 @@ proc Next {square} {
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]
}
}
@@ -92,7 +94,7 @@ proc MovePiece {dlg last square} {
$dlg.f.txt see end
$dlg.f.c itemconfigure [expr {1+$last}] -state normal -outline black
$dlg.f.c itemconfigure [expr {1+$square}] -state normal -outline red
- $dlg.f.c coords knight [lrange [$dlg.f.c coords [expr {1+$square}]] 0 1]
+ $dlg.f.c moveto knight {*}[lrange [$dlg.f.c coords [expr {1+$square}]] 0 1]
lappend visited $square
set next [Next $square]
if {$next ne -1} {
@@ -125,8 +127,8 @@ proc Tour {dlg {square {}}} {
$dlg.f.c itemconfigure $n -state disabled -outline black
}
if {$square eq {}} {
- set square [expr {[$dlg.f.c find closest \
- {*}[$dlg.f.c coords knight] 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]
@@ -161,7 +163,7 @@ proc DragMotion {w x y} {
}
proc DragEnd {w x y} {
set square [$w find closest $x $y 0 65]
- $w coords selected [lrange [$w coords $square] 0 1]
+ $w moveto selected {*}[lrange [$w coords $square] 0 1]
$w dtag selected
variable dragging ; unset dragging
}
@@ -201,10 +203,21 @@ proc CreateGUI {} {
-width 2 -state disabled
}
}
- catch {eval font create KnightFont -size -24}
- $c create text 0 0 -font KnightFont -text "\u265e" \
- -anchor nw -tags knight -fill black -activefill "#600000"
- $c coords knight [lrange [$c coords [expr {1 + int(rand() * 64)}]] 0 1]
+ if {[tk windowingsystem] ne "x11"} {
+ catch {eval font create KnightFont -size -24}
+ $c create text 0 0 -font KnightFont -text "\u265e" \
+ -anchor nw -tags knight -fill black -activefill "#600000"
+ } else {
+ # On X11 we cannot reliably tell if the \u265e 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"
+ }
+ $c moveto knight {*}[lrange [$c coords [expr {1 + int(rand() * 64)}]] 0 1]
$c bind knight <ButtonPress-1> [namespace code [list DragStart %W %x %y]]
$c bind knight <Motion> [namespace code [list DragMotion %W %x %y]]
$c bind knight <ButtonRelease-1> [namespace code [list DragEnd %W %x %y]]
diff --git a/library/demos/label.tcl b/library/demos/label.tcl
index cb26e6d..9b35f4b 100644
--- a/library/demos/label.tcl
+++ b/library/demos/label.tcl
@@ -3,7 +3,7 @@
# This demonstration script creates a toplevel window containing
# several label widgets.
#
-# RCS: @(#) $Id: label.tcl,v 1.6 2004/12/21 11:56:35 dkf Exp $
+# RCS: @(#) $Id: label.tcl,v 1.8 2009/09/04 10:03:44 dkf Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -18,7 +18,7 @@ wm title $w "Label Demonstration"
wm iconname $w "label"
positionWindow $w
-label $w.msg -font $font -wraplength 4i -justify left -text "Five labels are displayed below: three textual ones on the left, and a bitmap label and a text label on the right. Labels are pretty boring because you can't do anything with them."
+label $w.msg -font $font -wraplength 4i -justify left -text "Five labels are displayed below: three textual ones on the left, and an image label and a text label on the right. Labels are pretty boring because you can't do anything with them."
pack $w.msg -side top
## See Code / Dismiss buttons
@@ -35,7 +35,8 @@ label $w.left.l3 -text "Third label, sunken" -relief sunken
pack $w.left.l1 $w.left.l2 $w.left.l3 -side top -expand yes -pady 2 -anchor w
# Main widget program sets variable tk_demoDirectory
-label $w.right.bitmap -borderwidth 2 -relief sunken \
- -bitmap @[file join $tk_demoDirectory images face.xbm]
-label $w.right.caption -text "Tcl/Tk Proprietor"
-pack $w.right.bitmap $w.right.caption -side top
+image create photo label.ousterhout \
+ -file [file join $tk_demoDirectory images ouster.png]
+label $w.right.picture -borderwidth 2 -relief sunken -image label.ousterhout
+label $w.right.caption -text "Tcl/Tk Creator"
+pack $w.right.picture $w.right.caption -side top
diff --git a/library/demos/mclist.tcl b/library/demos/mclist.tcl
index 18d8781..ba21c01 100644
--- a/library/demos/mclist.tcl
+++ b/library/demos/mclist.tcl
@@ -3,14 +3,13 @@
# This demonstration script creates a toplevel window containing a Ttk
# tree widget configured as a multi-column listbox.
#
-# RCS: @(#) $Id: mclist.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: mclist.tcl,v 1.6 2009/07/15 21:50:52 das Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
package require Tk
-package require Ttk
set w .mclist
catch {destroy $w}
@@ -29,19 +28,22 @@ pack [addSeeDismiss $w.seeDismiss $w] -side bottom -fill x
ttk::frame $w.container
ttk::treeview $w.tree -columns {country capital currency} -show headings \
-yscroll "$w.vsb set" -xscroll "$w.hsb set"
-if {[tk windowingsystem] ne "aqua"} {
- ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
- ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
-} else {
- scrollbar $w.vsb -orient vertical -command "$w.tree yview"
- scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
-}
+ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
+ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
pack $w.container -fill both -expand 1
grid $w.tree $w.vsb -in $w.container -sticky nsew
grid $w.hsb -in $w.container -sticky nsew
grid column $w.container 0 -weight 1
grid row $w.container 0 -weight 1
+image create photo upArrow -data {
+ R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAImhI+
+ py+1LIsJHiBAh+BgmiEAJQITgW6DgUQIAECH4JN8IPqYuNxUAOw==}
+image create photo downArrow -data {
+ R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAInhI+
+ py+1I4ocQ/IgDEYIPgYJICUCE4F+YIBolEoKPEJKZmVJK6ZACADs=}
+image create photo noArrow -height 14 -width 14
+
## The data we're going to insert
set data {
Argentina {Buenos Aires} ARS
@@ -62,11 +64,15 @@ set data {
}
## Code to insert the data nicely
-set font [ttk::style lookup [$w.tree cget -style] -font]
+set font [ttk::style lookup Heading -font]
foreach col {country capital currency} name {Country Capital Currency} {
- $w.tree heading $col -command [list SortBy $w.tree $col 0] -text $name
- $w.tree column $col -width [font measure $font $name]
+ $w.tree heading $col -text $name -image noArrow -anchor w \
+ -command [list SortBy $w.tree $col 0]
+ $w.tree column $col -width [expr {
+ [font measure $font $name] + [image width noArrow] + 5
+ }]
}
+set font [ttk::style lookup Treeview -font]
foreach {country capital currency} $data {
$w.tree insert {} end -values [list $country $capital $currency]
foreach col {country capital currency} {
@@ -79,6 +85,16 @@ foreach {country capital currency} $data {
## Code to do the sorting of the tree contents when clicked on
proc SortBy {tree col direction} {
+ # Determine currently sorted column and its sort direction
+ foreach c {country capital currency} {
+ set s [$tree heading $c state]
+ if {("selected" in $s || "alternate" in $s) && $col ne $c} {
+ # Sorted column has changed
+ $tree heading $c -image noArrow state {!selected !alternate !user1}
+ set direction [expr {"alternate" in $s}]
+ }
+ }
+
# Build something we can sort
set data {}
foreach row [$tree children {}] {
@@ -94,5 +110,12 @@ proc SortBy {tree col direction} {
}
# Switch the heading so that it will sort in the opposite direction
- $tree heading $col -command [list SortBy $tree $col [expr {!$direction}]]
+ $tree heading $col -command [list SortBy $tree $col [expr {!$direction}]] \
+ state [expr {$direction?"!selected alternate":"selected !alternate"}]
+ if {[ttk::style theme use] eq "aqua"} {
+ # Aqua theme displays native sort arrows when user1 state is set
+ $tree heading $col state "user1"
+ } else {
+ $tree heading $col -image [expr {$direction?"upArrow":"downArrow"}]
+ }
}
diff --git a/library/demos/msgbox.tcl b/library/demos/msgbox.tcl
index fb986e1..1e09cb5 100644
--- a/library/demos/msgbox.tcl
+++ b/library/demos/msgbox.tcl
@@ -2,14 +2,13 @@
#
# This demonstration script creates message boxes of various type
#
-# RCS: @(#) $Id: msgbox.tcl,v 1.6 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: msgbox.tcl,v 1.7 2008/12/11 18:13:08 jenglish Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
package require Tk
-package require Ttk
set w .msgbox
catch {destroy $w}
diff --git a/library/demos/nl.msg b/library/demos/nl.msg
index b17ceaa..61832d8 100644
--- a/library/demos/nl.msg
+++ b/library/demos/nl.msg
@@ -18,7 +18,7 @@
::msgcat::mcset nl "Demo code: %s" "Code van Demo %s"
::msgcat::mcset nl "About Widget Demo" "Over deze demonstratie"
::msgcat::mcset nl "Tk widget demonstration" "Demonstratie van Tk widgets"
-::msgcat::mcset nl "Copyright (c) %s" "Copyright (c) %s"
+::msgcat::mcset nl "Copyright \u00a9 %s"
::msgcat::mcset nl "Tk Widget Demonstrations" "Demostratie van Tk widgets"
::msgcat::mcset nl "This application provides a front end for several short scripts" \
diff --git a/library/demos/pendulum.tcl b/library/demos/pendulum.tcl
index f785303..e920c5d 100644
--- a/library/demos/pendulum.tcl
+++ b/library/demos/pendulum.tcl
@@ -3,7 +3,7 @@
# This demonstration illustrates how Tcl/Tk can be used to construct
# simulations of physical systems.
#
-# RCS: @(#) $Id: pendulum.tcl,v 1.3.4.1 2009/08/08 08:28:40 dkf Exp $
+# RCS: @(#) $Id: pendulum.tcl,v 1.5 2009/08/08 08:23:40 dkf Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -51,9 +51,9 @@ for {set i 90} {$i>=0} {incr i -10} {
# Coordinates of these items don't matter; they will be set properly below
$w.k create line 0 0 1 1 -smooth true -tags graph$i -fill grey$i
}
-# FIXME: UNICODE labels
-$w.k create text 0 0 -anchor ne -text "q" -font {Symbol 8} -tags label_theta
-$w.k create text 0 0 -anchor ne -text "dq" -font {Symbol 8} -tags label_dtheta
+
+$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
pack $w.k -in $w.p.l2 -fill both -expand true
# Initialize some variables
diff --git a/library/demos/rmt b/library/demos/rmt
index 41cee5c..13b7ac9 100644
--- a/library/demos/rmt
+++ b/library/demos/rmt
@@ -1,13 +1,13 @@
#!/bin/sh
# the next line restarts using wish \
-exec wish "$0" "$@"
+exec wish "$0" ${1+"$@"}
# rmt --
# This script implements a simple remote-control mechanism for
# Tk applications. It allows you to select an application and
# then type commands to that application.
#
-# RCS: @(#) $Id: rmt,v 1.6 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: rmt,v 1.7 2009/03/25 23:27:14 nijtmans Exp $
package require Tcl 8.4
package require Tk
diff --git a/library/demos/square b/library/demos/square
index 743148d..8bcb5a7 100644
--- a/library/demos/square
+++ b/library/demos/square
@@ -1,6 +1,6 @@
#!/bin/sh
# the next line restarts using wish \
-exec wish "$0" "$@"
+exec wish "$0" ${1+"$@"}
# square --
# This script generates a demo application containing only a "square"
@@ -11,7 +11,7 @@ exec wish "$0" "$@"
# Button-1 press/drag: moves square to mouse
# "a": toggle size animation on/off
#
-# RCS: @(#) $Id: square,v 1.3 2003/09/30 14:54:30 dkf Exp $
+# RCS: @(#) $Id: square,v 1.4 2009/03/25 23:27:13 nijtmans Exp $
package require Tk ;# We use Tk generally, and...
package require Tktest ;# ... we use the square widget too.
diff --git a/library/demos/tcolor b/library/demos/tcolor
index b695c60..c92de1c 100644
--- a/library/demos/tcolor
+++ b/library/demos/tcolor
@@ -1,13 +1,13 @@
#!/bin/sh
# the next line restarts using wish \
-exec wish "$0" "$@"
+exec wish "$0" ${1+"$@"}
# tcolor --
# This script implements a simple color editor, where you can
# create colors using either the RGB, HSB, or CYM color spaces
# and apply the color to existing applications.
#
-# RCS: @(#) $Id: tcolor,v 1.6 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: tcolor,v 1.7 2009/03/25 23:27:14 nijtmans Exp $
package require Tk 8.4
wm title . "Color Editor"
diff --git a/library/demos/text.tcl b/library/demos/text.tcl
index 6f25273..5b8341d 100644
--- a/library/demos/text.tcl
+++ b/library/demos/text.tcl
@@ -3,7 +3,7 @@
# This demonstration script creates a text widget that describes
# the basic editing functions.
#
-# RCS: @(#) $Id: text.tcl,v 1.8 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: text.tcl,v 1.9 2008/12/10 05:02:51 das Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -19,7 +19,8 @@ wm iconname $w "text"
positionWindow $w
## See Code / Dismiss buttons
-set btns [addSeeDismiss $w.buttons $w]
+set btns [addSeeDismiss $w.buttons $w {} \
+ {ttk::button $w.buttons.fontchooser -command fontchooserToggle}]
pack $btns -side bottom -fill x
text $w.text -yscrollcommand [list $w.scroll set] -setgrid 1 \
@@ -27,6 +28,30 @@ text $w.text -yscrollcommand [list $w.scroll set] -setgrid 1 \
scrollbar $w.scroll -command [list $w.text yview]
pack $w.scroll -side right -fill y
pack $w.text -expand yes -fill both
+
+# TIP 324 Demo: [tk fontchooser]
+proc fontchooserToggle {} {
+ tk fontchooser [expr {[tk fontchooser configure -visible] ?
+ "hide" : "show"}]
+}
+proc fontchooserVisibility {w} {
+ $w configure -text [expr {[tk fontchooser configure -visible] ?
+ "Hide Font Dialog" : "Show Font Dialog"}]
+}
+proc fontchooserFocus {w} {
+ tk fontchooser configure -font [$w cget -font] \
+ -command [list fontchooserFontSel $w]
+}
+proc fontchooserFontSel {w font args} {
+ $w configure -font [font actual $font]
+}
+tk fontchooser configure -parent $w
+bind $w.text <FocusIn> [list fontchooserFocus $w.text]
+fontchooserVisibility $w.buttons.fontchooser
+bind $w <<TkFontchooserVisibility>> [list \
+ fontchooserVisibility $w.buttons.fontchooser]
+focus $w.text
+
$w.text insert 0.0 \
{This window is a text widget. It displays one or more lines of text
and allows you to edit the text. Here is a summary of the things you
diff --git a/library/demos/timer b/library/demos/timer
index 99e6f4c..b4ed74a 100644
--- a/library/demos/timer
+++ b/library/demos/timer
@@ -1,11 +1,11 @@
#!/bin/sh
# the next line restarts using wish \
-exec wish "$0" "$@"
+exec wish "$0" ${1+"$@"}
# timer --
# This script generates a counter with start and stop buttons.
#
-# RCS: @(#) $Id: timer,v 1.4 2003/09/30 14:54:30 dkf Exp $
+# RCS: @(#) $Id: timer,v 1.5 2009/03/25 23:27:12 nijtmans Exp $
package require Tcl 8.4
package require Tk
diff --git a/library/demos/toolbar.tcl b/library/demos/toolbar.tcl
index 74a490f..81724eb 100644
--- a/library/demos/toolbar.tcl
+++ b/library/demos/toolbar.tcl
@@ -2,14 +2,13 @@
#
# This demonstration script creates a toolbar that can be torn off.
#
-# RCS: @(#) $Id: toolbar.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: toolbar.tcl,v 1.4 2008/12/11 18:13:08 jenglish Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
package require Tk
-package require Ttk
set w .toolbar
destroy $w
diff --git a/library/demos/tree.tcl b/library/demos/tree.tcl
index b46943a..828560d 100644
--- a/library/demos/tree.tcl
+++ b/library/demos/tree.tcl
@@ -3,14 +3,13 @@
# This demonstration script creates a toplevel window containing a Ttk
# tree widget.
#
-# RCS: @(#) $Id: tree.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: tree.tcl,v 1.5 2008/12/11 18:13:08 jenglish Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
package require Tk
-package require Ttk
set w .tree
catch {destroy $w}
@@ -74,13 +73,8 @@ proc populateTree {tree node} {
## Create the tree and set it up
ttk::treeview $w.tree -columns {fullpath type size} -displaycolumns {size} \
-yscroll "$w.vsb set" -xscroll "$w.hsb set"
-if {[tk windowingsystem] ne "aqua"} {
- ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
- ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
-} else {
- scrollbar $w.vsb -orient vertical -command "$w.tree yview"
- scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
-}
+ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview"
+ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview"
$w.tree heading \#0 -text "Directory Structure"
$w.tree heading size -text "File Size"
$w.tree column size -stretch 0 -width 70
diff --git a/library/demos/ttkbut.tcl b/library/demos/ttkbut.tcl
index 3d5d3a8..5235cdc 100644
--- a/library/demos/ttkbut.tcl
+++ b/library/demos/ttkbut.tcl
@@ -4,14 +4,13 @@
# simple Ttk widgets, such as labels, labelframes, buttons, checkbuttons and
# radiobuttons.
#
-# RCS: @(#) $Id: ttkbut.tcl,v 1.4 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: ttkbut.tcl,v 1.5 2008/12/11 18:13:08 jenglish Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
package require Tk
-package require Ttk
set w .ttkbut
catch {destroy $w}
diff --git a/library/demos/ttkmenu.tcl b/library/demos/ttkmenu.tcl
index 235b4b1..59a9452 100644
--- a/library/demos/ttkmenu.tcl
+++ b/library/demos/ttkmenu.tcl
@@ -3,14 +3,13 @@
# This demonstration script creates a toplevel window containing several Ttk
# menubutton widgets.
#
-# RCS: @(#) $Id: ttkmenu.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: ttkmenu.tcl,v 1.4 2008/12/11 18:13:08 jenglish Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
package require Tk
-package require Ttk
set w .ttkmenu
catch {destroy $w}
diff --git a/library/demos/ttknote.tcl b/library/demos/ttknote.tcl
index f7c70a3..5a4e728 100644
--- a/library/demos/ttknote.tcl
+++ b/library/demos/ttknote.tcl
@@ -3,14 +3,13 @@
# This demonstration script creates a toplevel window containing a Ttk
# notebook widget.
#
-# RCS: @(#) $Id: ttknote.tcl,v 1.5 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: ttknote.tcl,v 1.6 2008/12/11 18:13:08 jenglish Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
package require Tk
-package require Ttk
set w .ttknote
catch {destroy $w}
@@ -55,10 +54,6 @@ ttk::frame $w.note.editor
$w.note add $w.note.editor -text "Text Editor" -underline 0
text $w.note.editor.t -width 40 -height 10 -wrap char \
-yscroll "$w.note.editor.s set"
-if {[tk windowingsystem] ne "aqua"} {
- ttk::scrollbar $w.note.editor.s -orient vertical -command "$w.note.editor.t yview"
-} else {
- scrollbar $w.note.editor.s -orient vertical -command "$w.note.editor.t yview"
-}
+ttk::scrollbar $w.note.editor.s -orient vertical -command "$w.note.editor.t yview"
pack $w.note.editor.s -side right -fill y -padx {0 2} -pady 2
pack $w.note.editor.t -fill both -expand 1 -pady 2 -padx {2 0}
diff --git a/library/demos/ttkpane.tcl b/library/demos/ttkpane.tcl
index 549ef3f..9664ad2 100644
--- a/library/demos/ttkpane.tcl
+++ b/library/demos/ttkpane.tcl
@@ -2,14 +2,13 @@
#
# This demonstration script creates a Ttk pane with some content.
#
-# RCS: @(#) $Id: ttkpane.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: ttkpane.tcl,v 1.5 2008/12/11 18:13:08 jenglish Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
package require Tk
-package require Ttk
set w .ttkpane
catch {destroy $w}
@@ -53,7 +52,7 @@ proc every {delay script} {
uplevel #0 $script
after $delay [list every $delay $script]
}
-set zones {
+set testzones {
:Europe/Berlin
:America/Argentina/Buenos_Aires
:Africa/Johannesburg
@@ -67,7 +66,13 @@ set zones {
}
# Force a pre-load of all the timezones needed; otherwise can end up
# poor-looking synch problems!
-foreach zone $zones {clock format 0 -timezone $zone}
+set zones {}
+foreach zone $testzones {
+ if {![catch {clock format 0 -timezone $zone}]} {
+ lappend zones $zone
+ }
+}
+if {[llength $zones] < 2} { lappend zones -0200 :GMT :UTC +0200 }
foreach zone $zones {
set city [string map {_ " "} [regexp -inline {[^/]+$} $zone]]
if {$i} {
diff --git a/library/demos/ttkprogress.tcl b/library/demos/ttkprogress.tcl
index 2db6d59..98388b5 100644
--- a/library/demos/ttkprogress.tcl
+++ b/library/demos/ttkprogress.tcl
@@ -2,14 +2,13 @@
#
# This demonstration script creates several progress bar widgets.
#
-# RCS: @(#) $Id: ttkprogress.tcl,v 1.3 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: ttkprogress.tcl,v 1.4 2008/12/11 18:13:08 jenglish Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
}
package require Tk
-package require Ttk
set w .ttkprogress
catch {destroy $w}
diff --git a/library/demos/ttkscale.tcl b/library/demos/ttkscale.tcl
index 5c0bdbe..dbd09a3 100644
--- a/library/demos/ttkscale.tcl
+++ b/library/demos/ttkscale.tcl
@@ -2,7 +2,7 @@
#
# This demonstration script shows an example with a horizontal scale.
#
-# RCS: @(#) $Id: ttkscale.tcl,v 1.1.2.2 2009/12/16 13:19:47 dkf Exp $
+# RCS: @(#) $Id: ttkscale.tcl,v 1.3 2009/12/16 13:20:18 dkf Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
diff --git a/library/demos/twind.tcl b/library/demos/twind.tcl
index 102be12..062fc61 100644
--- a/library/demos/twind.tcl
+++ b/library/demos/twind.tcl
@@ -3,7 +3,7 @@
# This demonstration script creates a text widget with a bunch of
# embedded windows.
#
-# RCS: @(#) $Id: twind.tcl,v 1.11 2007/12/13 15:27:07 dgp Exp $
+# RCS: @(#) $Id: twind.tcl,v 1.12 2009/02/11 15:17:26 dkf Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -164,7 +164,7 @@ $t window create end -window $t.smallP
$t insert end "\n\nFinally, images fit comfortably in text widgets too:"
$t image create end -image \
- [image create bitmap -file [file join $tk_demoDirectory images face.xbm]]
+ [image create photo -file [file join $tk_demoDirectory images ouster.png]]
proc textWindBigB w {
diff --git a/library/demos/unicodeout.tcl b/library/demos/unicodeout.tcl
index 8e108b6..46bbfd2 100644
--- a/library/demos/unicodeout.tcl
+++ b/library/demos/unicodeout.tcl
@@ -3,7 +3,7 @@
# This demonstration script shows how you can produce output (in label
# widgets) using many different alphabets.
#
-# RCS: @(#) $Id: unicodeout.tcl,v 1.7.2.1 2009/12/15 03:43:33 kennykb Exp $
+# RCS: @(#) $Id: unicodeout.tcl,v 1.9 2009/12/15 11:50:33 dkf Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -11,26 +11,6 @@ if {![info exists widgetDemo]} {
package require Tk
-# On Windows, we need to determine whether the font system will render
-# right-to-left text.
-
-if {[tk windowingsystem] eq {win32}} {
- set rkey [join {
- HKEY_LOCAL_MACHINE
- SOFTWARE
- Microsoft
- {Windows NT}
- CurrentVersion
- LanguagePack
- } \\]
- set w32langs {}
- if {![catch {package require registry}]} {
- if {[catch {registry values $rkey} w32langs]} {
- set w32langs {}
- }
- }
-}
-
set w .unicodeout
catch {destroy $w}
toplevel $w
@@ -52,11 +32,9 @@ pack $w.msg -side top
set btns [addSeeDismiss $w.buttons $w]
pack $btns -side bottom -fill x
-pack [label $w.wait -text "Please wait while loading fonts..." \
- -font {Helvetica 12 italic}]
-pack [frame $w.f] -expand 1 -fill both -padx 2m -pady 1m
+## The frame that will contain the sample texts.
+pack [frame $w.f] -side bottom -expand 1 -fill both -padx 2m -pady 1m
grid columnconfigure $w.f 1 -weight 1
-
set i 0
proc addSample {w language args} {
global font i
@@ -68,42 +46,87 @@ proc addSample {w language args} {
grid configure $w.f.l$j -padx 1m
}
-# Processing when some characters are missing might take a while, so make
-# sure we're displaying something in the meantime...
+## A helper procedure that determines what form to use to express languages
+## that have complex rendering rules...
+proc usePresentationFormsFor {language} {
+ switch [tk windowingsystem] {
+ aqua {
+ # OSX wants natural character order; the renderer knows how to
+ # compose things for display for all languages.
+ return false
+ }
+ x11 {
+ # The X11 font renderers that Tk supports all know nothing about
+ # composing characters, so we need to use presentation forms.
+ return true
+ }
+ win32 {
+ # On Windows, we need to determine whether the font system will
+ # render right-to-left text. This varies by language!
+ try {
+ package require registry
+ set rkey [join {
+ HKEY_LOCAL_MACHINE
+ SOFTWARE
+ Microsoft
+ {Windows NT}
+ CurrentVersion
+ LanguagePack
+ } \\]
+ return [expr {
+ [string toupper $language] ni [registry values $rkey]
+ }]
+ } trap error {} {
+ # Cannot work it out, so use presentation forms.
+ return true
+ }
+ }
+ default {
+ # Default to using presentation forms.
+ return true
+ }
+ }
+}
+## Processing when some characters are not currently cached by the display
+## engine might take a while, so make sure we're displaying something in the
+## meantime...
+pack [label $w.wait -text "Please wait while loading fonts..." \
+ -font {Helvetica 12 italic}]
set oldCursor [$w cget -cursor]
$w conf -cursor watch
update
-if {[tk windowingsystem] eq {x11}
- || (([tk windowingsystem] eq {win32}) && ({ARABIC} ni $w32langs))} {
+## 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"
+ "\uFE94\uFEF4\uFE91\uFEAE\uFECC\uFEDF\uFE8D " \
+ "\uFE94\uFEE4\uFEE0\uFEDC\uFEDF\uFE8D"
} else {
# Using standard text characters
addSample $w Arabic \
- "\u0627\u0644\u0643\u0644\u0645\u0629 " \
- "\u0627\u0644\u0639\u0631\u0628\u064A\u0629"
+ "\u0627\u0644\u0643\u0644\u0645\u0629 " \
+ "\u0627\u0644\u0639\u0631\u0628\u064A\u0629"
}
-addSample $w "Trad. Chinese" "\u4E2D\u570B\u7684\u6F22\u5B57"
+addSample $w "Trad. Chinese" "\u4E2D\u570B\u7684\u6F22\u5B57"
addSample $w "Simpl. Chinese" "\u6C49\u8BED"
+addSample $w French "Langue fran\u00E7aise"
addSample $w Greek \
"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AE " \
"\u03B3\u03BB\u03CE\u03C3\u03C3\u03B1"
-if {[tk windowingsystem] eq {x11}
- || (([tk windowingsystem] eq {win32}) && ({HEBREW} ni $w32langs))} {
+if {[usePresentationFormsFor Hebrew]} {
# Visual order (pre-layouted)
addSample $w Hebrew \
- "\u05EA\u05D9\u05E8\u05D1\u05E2 " \
- "\u05D1\u05EA\u05DB"
+ "\u05EA\u05D9\u05E8\u05D1\u05E2 \u05D1\u05EA\u05DB"
} else {
# Standard logical order
addSample $w Hebrew \
- "\u05DB\u05EA\u05D1 " \
- "\u05E2\u05D1\u05E8\u05D9\u05EA"
+ "\u05DB\u05EA\u05D1 \u05E2\u05D1\u05E8\u05D9\u05EA"
}
+addSample $w Hindi \
+ "\u0939\u093f\u0928\u094d\u0926\u0940 \u092d\u093e\u0937\u093e"
+addSample $w Icelandic "\u00CDslenska"
addSample $w Japanese \
"\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \
"\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA"
@@ -111,6 +134,6 @@ addSample $w Korean "\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00"
addSample $w Russian \
"\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u044F\u0437\u044B\u043A"
-# We're done processing, so change things back to normal running...
+## We're done processing, so change things back to normal running...
destroy $w.wait
$w conf -cursor $oldCursor
diff --git a/library/demos/widget b/library/demos/widget
index 5acba79..8a8d799 100644
--- a/library/demos/widget
+++ b/library/demos/widget
@@ -1,6 +1,6 @@
#!/bin/sh
# the next line restarts using wish \
-exec wish "$0" "$@"
+exec wish "$0" ${1+"$@"}
# widget --
# This script demonstrates the various widgets provided by Tk, along with many
@@ -10,12 +10,11 @@ exec wish "$0" "$@"
# separate ".tcl" files is this directory, which are sourced by this script as
# needed.
#
-# RCS: @(#) $Id: widget,v 1.51.2.3 2010/01/20 23:43:51 patthoyts Exp $
+# RCS: @(#) $Id: widget,v 1.60 2010/11/05 07:49:34 nijtmans Exp $
package require Tcl 8.5
package require Tk 8.5
package require msgcat
-package require Ttk
eval destroy [winfo child .]
set tk_demoDirectory [file join [pwd] [file dirname [info script]]]
@@ -320,16 +319,13 @@ addFormattedText {
@@demo image1 Two labels displaying images
@@demo image2 A simple user interface for viewing images
@@demo labelframe Labelled frames
- @@new
@@demo ttkbut The simple Themed Tk widgets
@@subtitle Listboxes and Trees
@@demo states The 50 states
@@demo colors Colors: change the color scheme for the application
@@demo sayings A collection of famous and infamous sayings
- @@new
@@demo mclist A multi-column list of countries
- @@new
@@demo tree A directory browser tree
@@subtitle Entries, Spin-boxes and Combo-boxes
@@ -337,7 +333,6 @@ addFormattedText {
@@demo entry2 Entries with scrollbars
@@demo entry3 Validated entries and password fields
@@demo spin Spin-boxes
- @@new
@@demo combo Combo-boxes
@@demo form Simple Rolodex-like form
@@ -347,7 +342,6 @@ addFormattedText {
@@demo bind Hypertext (tag bindings)
@@demo twind A text widget with embedded windows and other features
@@demo search A search tool built with a text widget
- @@new
@@demo textpeer Peering text widgets
@@subtitle Canvases
@@ -358,7 +352,6 @@ 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
@@ -366,38 +359,30 @@ addFormattedText {
@@demo vscale Vertical scale
@@new
@@demo ttkscale Themed scale linked to a label with traces
- @@new
@@demo ttkprogress Progress bar
@@subtitle Paned Windows and Notebooks
@@demo paned1 Horizontal paned window
@@demo paned2 Vertical paned window
- @@new
@@demo ttkpane Themed nested panes
- @@new
@@demo ttknote Notebook widget
@@subtitle Menus and Toolbars
@@demo menu Menus and cascades (sub-menus)
@@demo menubu Menu-buttons
- @@new
@@demo ttkmenu Themed menu buttons
- @@new
@@demo toolbar Themed toolbar
@@subtitle Common Dialogs
@@demo msgbox Message boxes
@@demo filebox File selection dialog
@@demo clrpick Color picker
+ @@demo fontchoose Font selection dialog
@@subtitle Animation
- @@new
@@demo anilabel Animated labels
- @@new
@@demo aniwave Animated wave
- @@new
@@demo pendulum Pendulum simulation
- @@new
@@demo goldberg A celebration of Rube Goldberg
@@subtitle Miscellaneous
@@ -726,10 +711,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 (c) %s} {1996-1997 Sun Microsystems, Inc.}]
-[mc {Copyright (c) %s} {1997-2000 Ajuba Solutions, Inc.}]
-[mc {Copyright (c) %s} {2001-2007 Donal K. Fellows}]
-[mc {Copyright (c) %s} {2002-2007 Daniel A. Steffen}]"
+"[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}]"
}
# Local Variables: