supports translation using the platform and locale encodings in the local operating system with latin- as fallback python' tkinter passes bytes strings to tcl directlybut copies python str unicode strings to and from tcl unicode string objects tk inherits all of tcl' unicode policiesbut adds additional font selection policies for display in other wordsguis that display text in tkinter are somewhat at the mercy of multiple layers of softwareabove and beyond the python language itself in generalthoughunicode is broadly supported by tk' text widget for python strbut not for python bytes as you can probably tellthoughthis story quickly becomes very low-level and detailedso we won' explore it further in this booksee the web and other resources for more on tkintertkand tcland the interfaces between them other binary mode considerations even in contexts where it' sufficientusing binary mode files to finesse encodings for display is more complicated than you might think we always need to be careful to write output in binary modetooso what we read is what we later write--if we read in binary modecontent end-lines will be \ \ on windowsand we don' want textmode files to expand this to \ \ \ moreoverthere' another difference in tkinter for str and bytes str read from text-mode file appears in the gui as you expectand end-lines are mapped on windows as usualc:\pp \gui\tourpython from tkinter import text(str from text-mode file insert(' 'open('jack txt'read()platform default encoding pack(appears in gui normally get(' ''end')[: ' all work and no play makes jack dull boy \ all work and no plaif you pass in bytes obtained from binary-mode filehoweverit' odd in the gui on windows--there' an extra space at the end of each linewhich reflects the \ that is not stripped by binary mode filesc:\pp \gui\tourpython from tkinter import text(bytes from binary-mode insert(' 'open('jack txt''rb'read()no decoding occurs pack(lines have space at endt get(' ''end')[: ' all work and no play makes jack dull boy \ \ all work and no plto use bytes to allow for arbitrary text but make the text appear as expected by userswe also have to strip the \ characters at line end manually this assumes that \ \ combination doesn' mean something special in the text' encoding schemethough data in which this sequence does not mean end-of-line will likely have other issues when tkinter tourpart