The Tk Text Widget
A few problems can be found in using the Tk text widget. When a tool has been around for as long as this one, the number of problems become fairly small. There is one significant problem with the widget as it stands, however. In order to get the full benefits of margin handling and the like, text needs to be inserted without newline characters. That is, each paragraph needs to be one long string with a newline at the end. This allows the word wrapping to work properly. However, the widget's default keyboard navigation behaviour is that pressing the up or down arrow key moves up or down a real line, rather than a displayed line. The effect is to skip up or down a paragraph at a time instead of a line, and so the only way to move to the middle of a paragraph is to hold the right arrow key and allow the cursor to work its way across and downwards.
Given the quality of thought and implementation that clearly has gone into the rest of the widget, it's hard to see how this behaviour has been tolerated for so long. The problem finally was addressed for Tk 8.5, which, as of this writing, is in alpha release. In the meantime, the Tcler's Wiki has a workaround that installs more sensible behaviour, see Resources.
The Tk text widget is a remarkably powerful tool available to script writers who work with Tcl, Python and Perl. In its basic form it allows multi-line text entry, with rich text formatting and undo facilities where appropriate. Its more powerful features provide a framework for implementing all sorts of interesting facilities, including image handling, embedded GUI controls, mouse overs and hyperlinks. If your application involves the manipulation or presentation of textual information, the abilities of Tk's text widget should not be overlooked.
Practical books for the most technical people on the planet. Newly available books include:
- Agile Product Development by Ted Schmidt
- Improve Business Processes with an Enterprise Job Scheduler by Mike Diehl
- Finding Your Way: Mapping Your Network to Improve Manageability by Bill Childers
- DIY Commerce Site by Reven Lerner
Plus many more.
- Unikernels, Docker, and Why You Should Care
- Server Hardening
- diff -u: What's New in Kernel Development
- Controversy at the Linux Foundation
- 22 Years of Linux Journal on One DVD - Now Available
- Non-Linux FOSS: Snk
- Giving Silos Their Due
- Don't Burn Your Android Yet
- What's New in 3D Printing, Part III: the Software