24. The Text Widget

This chapter describes Tk’s text widget, which displays one or more lines of text. The text widget can also display embedded images and widgets. The text widget can be used to display text, provides the ability to edit text, and even presents an interface for interacting with HTML or other tagged text.

24.1 Text Widget Basics

You create a text widget with the text command:

text widgetName ?option value ...?

The text widget supports many common widget options, such as -background, -foreground, and -font, which determine the default settings of the text displayed; additional options specific to the text widget, such as -tabs and -wrap, provide default tab stops and line-wrapping settings. As you will see in Section 24.4, all ...

Get Tcl and the Tk Toolkit, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.