unicodeout.tcl
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
- # unicodeout.tcl --
- #
- # This demonstration script shows how you can produce output (in label
- # widgets) using many different alphabets.
- #
- # RCS: @(#) $Id: unicodeout.tcl,v 1.2 2003/02/21 13:05:06 dkf Exp $
- if {![info exists widgetDemo]} {
- error "This script should be run from the "widget" demo."
- }
- set w .unicodeout
- catch {destroy $w}
- toplevel $w
- wm title $w "Unicode Label Demonstration"
- wm iconname $w "unicodeout"
- positionWindow $w
- label $w.msg -font $font -wraplength 4i -justify left
- -text "This is a sample of Tk's support for languages that use
- 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 escape so as to do so in a
- portable fashion."
- pack $w.msg -side top
- frame $w.buttons
- pack $w.buttons -side bottom -fill x -pady 2m
- button $w.buttons.dismiss -text Dismiss -command "destroy $w"
- button $w.buttons.code -text "See Code" -command "showCode $w"
- pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
- 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
- grid columnconfigure $w.f 1 -weight 1
- set i 0
- proc addSample {w language args} {
- global font i
- set sample [join $args ""]
- set j [incr i]
- label $w.f.l$j -font $font -text "${language}:" -anchor nw -pady 0
- label $w.f.s$j -font $font -text $sample -anchor nw -width 30 -pady 0
- grid $w.f.l$j $w.f.s$j -sticky ew -pady 0
- 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...
- set oldCursor [$w cget -cursor]
- $w conf -cursor watch
- update
- addSample $w Arabic
- "uFE94uFEF4uFE91uFEAEuFECCuFEDFuFE8DuFE94"
- "uFEE4uFEE0uFEDCuFEDFuFE8D"
- addSample $w "Trad. Chinese" "u4E2Du570Bu7684u6F22u5B57"
- addSample $w "Simpl. Chinese" "u6C49u8BED"
- addSample $w Greek
- "u0395u03BBu03BBu03B7u03BDu03B9u03BAu03AE "
- "u03B3u03BBu03CEu03C3u03C3u03B1"
- addSample $w Hebrew
- "u05DDu05D9u05DCu05E9u05D5u05E8u05D9 "
- "u05DCu05D9u05D0u05E8u05E9u05D9"
- addSample $w Japanese
- "u65E5u672Cu8A9Eu306Eu3072u3089u304Cu306A, "
- "u6F22u5B57u3068u30ABu30BFu30ABu30CA"
- addSample $w Korean "uB300uD55CuBBFCuAD6DuC758 uD55CuAE00"
- addSample $w Russian
- "u0420u0443u0441u0441u043Au0438u0439 u044Fu0437u044Bu043A"
- # We're done processing, so change things back to normal running...
- destroy $w.wait
- $w conf -cursor $oldCursor