Here is a story you don't hear every day. You know that AutoCorrect feature in MS Word? You type 'tihs' and Word replaces it with 'this'. I really love that feature. Not so much to correct my typos, but as a shorthand tool. I type 'ill go,w or wo u' and it automatically expands to 'I'll go, with or without you'. The part of the story that you don't hear every day is that I am so addicted to it and have used it for so long that I've built up a 10,000-entry list. Writing in Word, I shorthand all the time. So I tried to implement it in a Tk app. I load the entire list from a SQLite database into a Tcl array at startup, and every time I hit space or punctuation, the app searches for the last "word" just typed in the array, deletes that word and prints its counterpart. I still need to implement automatic capital letter in the beginning of sentences and some method to undo the auto correction. Ctrl+Z will not yield the expected(?) result. Apart from that, it is a perfect Auto Correct feature, ready to be implemented in any Tcl/Tk-based text editor. Thanks to Michael A. Cleverly for very useful hints. # First, you must have this text widget: $w.textframe.texto1 # Now, the binding. We want to launch 'AutoCorrect' every time we hit the space # and/or punctuation keys. These four lines will launch the function whenever # the last key pressed (%K) is found in the 'myACkeys' list: set myACkeys {space period comma colon semicolon question exclam slash backslash less greater equal asterisk plus minus parenleft parenright bracketleft bracketright braceleft braceright quotedbl quoteright} foreach key $myACkeys { bind $w.textframe.texto1 <$key> { autocorrect } } # Note: these bindings were obtained in Windows. They may vary in other platforms.