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.
|A Code Boot Camp for Underprivileged Kids||Jun 30, 2015|
|Comprehensive Identity Management and Audit for Red Hat Enterprise Linux||Jun 29, 2015|
|Linux Kernel 4.1 Released||Jun 26, 2015|
|Secure Server Deployments in Hostile Territory||Jun 25, 2015|
|Take Control of Growing Redis NoSQL Server Clusters||Jun 24, 2015|
|Django Templates||Jun 24, 2015|
- Comprehensive Identity Management and Audit for Red Hat Enterprise Linux
- Linux Kernel 4.1 Released
- Secure Server Deployments in Hostile Territory
- Django Templates
- Cinnamon 2.6 Released
- Gettin' Sticky with It
- Attack of the Drones
- Take Control of Growing Redis NoSQL Server Clusters
- Physics Analysis Workstation
- diff -u: What's New in Kernel Development