pp scrolledtext list test packerpacked all ['spam txt''ham txt''eggs txt'packingspam txt packingham txt packingeggs txt unpackerpacked all creatingspam txt creatingham txt creatingeggs txt this may be less than ideal for gui' usersthey may not expect (or even be able to findthe command-line console we can do better hereby redirecting stdout to an object that throws text up in gui window as it is received you'll have to read the next section to see how guistreamsredirecting streams to widgets on to our next gui coding techniquein response to the challenge posed at the end of the last sectionthe script in example - arranges to map input and output sources to pop-up windows in gui applicationmuch as we did with strings in the stream redirection topics in although this module is really just first-cut prototype and needs improvement itself ( each input line request pops up new input dialog--not exactly award winning ergonomics!)it demonstrates the concepts in general example - ' guioutput and guiinput objects define methods that allow them to masquerade as files in any interface that expects real file as we learned earlier in this includes both the print and input built-in functions for accessing standard streamsas well as explicit calls to the read and write methods of file objects the two top-level interfaces in this module handle common use casesthe redirectedguifunc function uses this plug-and-play file compatibility to run function with its standard input and output streams mapped completely to popup windows rather than to the console window (or wherever streams would otherwise be mapped in the system shellthe redirectedguishellcmd function similarly routes the output of spawned shell command line to pop-up window it can be used to display the output of any program in gui--including that printed by python program the module' guiinput and guioutput classes can also be used or customized directly by clients that need to match more direct file method interface or need more finegrained control over the process guistreamsredirecting streams to widgets