widget tour text it' been said that tkinter' strongest points may be its text and canvas widgets both provide remarkable amount of functionality for instancethe tkinter text widget was powerful enough to implement the web pages of grailan experimental web browser coded in pythontext supports complex font-style settingsembedded imagesunlimited undo and redoand much more the tkinter canvas widgeta general-purpose drawing deviceallows for efficient free-form graphics and has been the basis of sophisticated image-processing and visualization applications in we'll put these two widgets to use to implement text editors (pyedit)paint programs (pydraw)clock guis (pyclock)and image programs (pyphoto and pyviewfor the purposes of this tour thoughlet' start out using these widgets in simpler ways example - implements simple scrolled-text displaywhich knows how to fill its display with text string or file example - pp \gui\tour\scrolledtext py " simple text or file viewer componentprint('pp scrolledtext'from tkinter import class scrolledtext(frame)def __init__(selfparent=nonetext=''file=none)frame __init__(selfparentself pack(expand=yesfill=bothmake me expandable self makewidgets(self settext(textfiledef makewidgets(self)sbar scrollbar(selftext text(selfrelief=sunkensbar config(command=text yviewtext config(yscrollcommand=sbar setsbar pack(side=rightfill=ytext pack(side=leftexpand=yesfill=bothself text text xlink sbar and text move one moves other pack first=clip last text clipped first def settext(selftext=''file=none)if filetext open(file' 'read(self text delete(' 'endself text insert(' 'textself text mark_set(insert' 'self text focus(delete current text add at line col set insert cursor save user click def gettext(self)returns string tkinter tourpart