[ Tklib Home | Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

ntextBindings(n) 1.0 tklib "Alternative Bindings for the Text Widget"


ntextBindings - Alternative Bindings for the Text Widget

Table Of Contents


  • package require Tcl 8.5
  • package require Tk 8.5
  • package require ntext ?1.0?


The ntext package provides a binding tag named Ntext for use by text widgets in place of the default Text binding tag.

The Text binding tag provides around one hundred bindings to the text widget (the exact number is platform-dependent). A few of these behave in a way that is different from most contemporary text-editing applications. Ntext aims to provide more familiar behaviour.

Features of the Ntext bindings that differ from the default Text bindings:

In the last three cases, the behavior of Text is often useful, so Ntext gives you the option of retaining it, by setting variables defined in the ::ntext namespace to 1 (instead of their default 0). Explaining these features in more detail:


Ntext provides alternatives to a number of behaviours of the classic Text binding tag. Where there is an option, the Ntext behaviour is switched on by default, except for display-line indentation which is discussed on a separate page at ntextIndent.

The behaviour of Ntext may be configured application-wide by setting the values of a number of namespace variables:









In order to remain independent of the version of Tk (8.5 or 8.6), ntext defines its own virtual events. These new virtual events are used only in the Ntext binding tag, and therefore do not interfere with the real or virtual events used in other code.

These events include <<NtextCut>>, <<NtextCopy>>, <<NtextPaste>> which are used in place of <<Cut>>, <<Copy>>, <<Paste>> respectively.

The definition of the virtual event <<NtextCut>> (etc) is similar to that of <<Cut>> (etc) in Tk 8.6.


This version of ntext is intended to be compatible with all releases of Tk 8.5 and 8.6, and with the branches core-8-5-branch, core-8-6-branch, and trunk in the source code repository for Tk. Any incompatibility with any of these versions, for any Tk windowing system, should be reported as a bug. Please report such in the category ntext of the Tklib Trackers.


To use Ntext but keep classic Text 's variable-anchor feature:

package require ntext
text .t
set ::ntext::classicAnchor 1
bindtags .t {.t Ntext . all}

See Also

bindtags, ntext, ntextIndent, text


bindtags, text