proc ikey {c language} {       set f {{Bitstream Cyberbit} 10 bold}       set margin 7; set spacing 15       set x $margin; set y $margin       $c delete all       foreach key [get_keys $language] {          $c create text $x $y -text $key -tag ikey \             -font $f          if [incr x $spacing]>220 {              set x $margin; incr y $spacing          }       }       $c bind ikey <1> {         %W itemconf current -fill red         after 200 "%W itemconf current -fill black"         set cc [%W itemcget current -text]         if {$cc=="<"} {             event generate .          } else {            if {$cc=="_"} {set cc " "}            catch {[focus] insert insert $cc }            if [is_right_to_left $cc] {               event generate .             }         }       }    }    proc get_keys language {         return [clist $::ikey($language)]    }    proc is_right_to_left c {        foreach r_to_l_language [list Hebrew] {            if {-1 < [lsearch [get_keys $r_to_l_language] $c]} {                return 1            }        }        return 0    }    proc clist list {       set res ""       foreach item [lappend list "_,;.<"] {           if [regexp {^(.)-(.)$} $item -> from to] {             scan $to %c to              for {set i [scan $from %c]} {$i<=$to} {incr i} {                 lappend res [format %c $i]              }           } else {              eval lappend res [split $item ""]           }       }       set res    }    array set ::ikey {     Cyrillic {\u0410-\u044f}     Greek {1-9 0 - \u0391-\u03a1 \u03a3-\u03c9}     Hebrew {\u05d0-\u05ea}    }   proc test_app {} {       variable ikey       option add *Font {{Bitstream Cyberbit} 10}       entry .e       text .t -height 8 -width 1       canvas .c -width 240 -height 80 -bg yellow       pack .e .t .c -fill x       focus .t       ikey .c Greek       bind .  {exec wish $::argv0 &; exit}       . config -menu [menu .m]       .m add casc -label Language -menu [menu .m.l -tearoff 0]       foreach i [array names ikey] {         .m.l add comm -label $i -command [list ikey .c $i]       }   }   if {[file tail [info script]]==[file tail $argv0]} test_app