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.
Win an iPhone 6
Enter to Win
|Microsoft and Linux: True Romance or Toxic Love?||Nov 25, 2015|
|Non-Linux FOSS: Install Windows? Yeah, Open Source Can Do That.||Nov 24, 2015|
|Cipher Security: How to harden TLS and SSH||Nov 23, 2015|
|Web Stores Held Hostage||Nov 19, 2015|
|diff -u: What's New in Kernel Development||Nov 17, 2015|
|Recipy for Science||Nov 16, 2015|
- Microsoft and Linux: True Romance or Toxic Love?
- Cipher Security: How to harden TLS and SSH
- Non-Linux FOSS: Install Windows? Yeah, Open Source Can Do That.
- Web Stores Held Hostage
- PuppetLabs Introduces Application Orchestration
- Firefox's New Feature for Tighter Security
- diff -u: What's New in Kernel Development
- November 2015 Issue of Linux Journal: System Administration
- It's a Bird. It's Another Bird!
- Simple Photo Editing, Linux Edition!