A text widget can contain other widgets embedded it. These are called "embedded windows", and they can consist of arbitrary widgets. For example, here are two embedded button widgets. You can click on the first button to Turn On horizontal scrolling, which also turns off word wrapping. Or, you can click on the second button to Turn Off horizontal scrolling and turn back on word wrapping.
Or, here is another example. If you Click Here a canvas displaying an x-y plot will appear right here. You can drag the data points around with the mouse, or you can click here to Delete the plot again.
You may also find it useful to put embedded windows in a text without any actual text. In this case the text widget acts like a geometry manager. For example, here is a collection of buttons laid out neatly into rows by the text widget. These buttons can be used to change the background color of the text widget ("Default" restores the color to its default). If you click on the button labeled "Short", it changes to a longer string so that you can see how the text widget automatically changes the layout. Click on the button again to restore the short string.
Default Short AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4 SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3 LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2 SeaGreen1 Yellow IndianRed1 IndianRed2 Tan1 Tan4