if 0 { The Windows charmap utility drives me crazy. It has no way I can find to configure the size of the character display - you have to actually click on one and get the little pop-up in order to see the character. Aside from the basic ascii characters, none of the characters are recognizable. Now, this should be a simple application, so I knocked one together. It works, it's configurable, it's handy except for one thing. '''IT'S SLOWER THAN MOLASSES IN JANUARY!!!''' And I can't figure out why! The actual relabeling of the buttons takes no appreciable time, but using the scale to jump about in the unicode space leaves me with fifteen to thirty seconds of dead air before the darn thing repaints. Any gurus out there up to telling me what's wrong with my approach? } # charmap package require Tk wm withdraw . proc relabel { args } { set ::lastscr "" set row $::currow for { set i 0 } { $i < 200 } { incr i } { set r [ expr int($i/20)+1 ] set c [ expr ($i%20)+1 ] if { $c == 1 } { .top.rowlbl$r configure \ -text [ format %04X [expr $row+$i]] } set text [ format %04X [expr $row+$i]] if { "0x$text" > "0xffff" } { set text "" } eval set char "\\u$text" set font [ font create \ -family [ file rootname $::curfont ] -size 16 ] .top.btn-$r-$c configure -text $char -font $font } } proc insert { w } { set font [ font create \ -family [ file rootname $::curfont ] -size 24 ] .top.entry configure -font $font set char [ $w cget -text ] .top.entry insert end $char } set fontlist [ glob C:/WINDOWS/Fonts/\* ] if { [ catch { set font [ font create -family CODE2000 -size 24 ] set curfont [ glob C:/WINDOWS/Fonts/CODE2000* ] } ] != 0 } { set font [ font create -family Tahoma -size 24 ] set curfont [ glob C:/WINDOWS/Fonts/Tahoma* ] } set currow 0 toplevel .top wm protocol .top WM_DELETE_WINDOW { exit } ttk::combobox .top.fontlist -textvariable curfont \ -state readonly -values $fontlist -width 36 trace variable curfont w relabel label .top.font -text "Font: " -anchor w grid .top.font -row 0 -column 0 -sticky e grid .top.fontlist -row 0 -column 1 -columnspan 21 \ -sticky snew for { set i 1 } { $i <= 20 } { incr i } { for { set j 1 } { $j <= 10 } { incr j } { button .top.btn-$j-$i -width 1 -text "x" \ -command [ list insert .top.btn-$j-$i ] grid .top.btn-$j-$i -row $j -column $i -sticky snew } } for { set i 1 } { $i <= 10 } { incr i } { label .top.rowlbl$i -text "NNNN" grid .top.rowlbl$i -row $i -column 0 } scale .top.scale -showvalue 0 -from 0x0000 -to 0xffff \ -variable currow -resolution 200 bind .top.scale relabel grid .top.scale -row 1 -rowspan 11 -column 21 -sticky ns label .top.copy -text "Copy:" grid .top.copy -row 11 -column 0 -sticky e entry .top.entry -font $font grid .top.entry -row 11 -column 1 -columnspan 21 -sticky nsew relabel ---- if 0 { [AMucha] 2009 June 04 1. '''Always''' brace your expressions! 1. You create 200 distinct fonts with each call to relabel! (put the line with "font creeate" before the for-loop) 1. Better still you should use a named font font create utf8font_16 -family Tahoma -size 16 font create utf8font_24 -family Tahoma -size 24 # in your bouttons you use button .top.btn-$j-$i -width 1 -text "x" \ -command [ list insert .top.btn-$j-$i ] \ -font utf8font_16 # if your font changes you only say (once!) font configure utf8font_16 -family [ file rootname $::curfont ] # and automagicaly all your buttons use the new font 4. Read the manpage about "font families". Your code will then work with computers without a C:/WINDOWS/Fonts/ directory. } !!!!!! [ Category Application ] !!!!!!