write('% dall work and no play makes jack dull boy \nif close( :\pp \gui\tourpython makefile py :\pp \gui\tourpython scrolledtext py jack txt pp scrolledtext to view filepass its name on the command line--its text is automatically displayed in the new window by defaultit is shown in font that may vary per platform (and might not be fixed-width on some)but we'll pass font option to the text widget in the next example to change that pressing the escape key fetches and displays the full text content of the widget as single string (more on this in momentnotice the pp scrolledtext message printed when this script runs because there is also scrolledtext py file in the standard python distribution (in module tkinter scrolledtextwith very different implementation and interfacethe one here identifies itself when run or importedso you can tell which one you've got if the standard library' alternative ever goes awayimport the class listed to get simple text browserand adjust any text widget configuration calls to include text qualifier level ( text config instead of configthe library version subclasses text directlynot frameprogramming the text widget to understand how this script works at allthoughwe have to detour into few text widget details here earlier we met the entry and message widgetswhich address subset of the text widget' uses the text widget is much richer in both features and interfaces--it supports both input and display of multiple lines of textediting operations for both programs and interactive usersmultiple fonts and colorsand much more text objects are createdconfiguredand packed just like any other widgetbut they have properties all their own text is python string although the text widget is powerful toolits interface seems to boil down to two core concepts firstthe content of text widget is represented as string in python scriptsand multiple lines are separated with the normal \ line terminator the string 'words\ngo here'for instancerepresents two lines when stored in or fetched from text widgetit would normally have trailing \ alsobut it doesn' have to to help illustrate this pointthis script binds the escape key press to fetch and print the entire contents of the text widget it embedsc:\pp \gui\tourpython scrolledtext py pp scrolledtext 'words\ngo here'always look\non the bright\nside of life\ tkinter tourpart