may also be desirable to limit encoding attempts to just one such source in some contexts watch for this code in franklypyedit in this edition originally read and wrote files in text mode with platform default encodings didn' consider the implications of unicode on pyedit until the pymailgui example' internet world raised the specter of arbitrary text encodings if it seems that strings are lot more complicated than they used to beit' probably only because your scope has been too narrow advanced text and tag operations but enough about the idiosyncrasies of unicode text--let' get back to coding guis besides the position specification roles we've seen so farthe text widget' text tags can also be used to apply formatting and behavior to all characters in substring and all substrings added to tag in factthis is where much of the power of the text widget liestags have formatting attributes for setting colorfonttabsand line spacing and justificationto apply these to many parts of the text at onceassociate them with tag and apply formatting to the tag with the tag_config methodmuch like the general config widget we've been using tags can also have associated event bindingswhich let you implement things such as hyperlinks in text widgetclicking the text triggers its tag' event handler tag bindings are set with tag_bind methodmuch like the general widget bind method we've already met with tagsit' possible to display multiple configurations within the same text widgetfor instanceyou can apply one font to the text widget at large and other fonts to tagged text in additionthe text widget allows you to embed other widgets at an index (they are treated like single character)as well as images example - illustrates the basics of all these advanced tools at once and draws the interface captured in figure - this script applies formatting and event bindings to three tagged substringsdisplays text in two different font and color schemesand embeds an image and button double-clicking any of the tagged substrings (or the embedded buttonwith mouse triggers an event that prints "got tag eventmessage to stdout example - pp \gui\tour\texttags py "demo advanced tag and text interfacesfrom tkinter import root tk(def hello(event)print('got tag event'make and config text tkinter tourpart