notice how we're displaying bytes strings in figure - --even though the non-gui script prints textthe gui script reads it with the raw socket interfaceand sockets deal in binary byte strings in python run this example by yourself for closer look in high-level termsthe gui script spawns the non-gui script and displays pop-up window that shows the text printed by the non-gui script (the date and timethe non-gui script can keep running linearprocedural code to produce databecause only the gui script' process runs an eventdriven mainloop call moreoverunlike our earlier stream redirection explorations which simply connected the script' streams to gui objects running in the same processthis decoupled twoprocess approach prevents the gui from being blocked while waiting for the script to produce outputthe gui process remains fully and independently activeand simply picks up new results as they appear (more on this in the next sectionthis model is similar in spirit to our earlier thread queue examplesbut the actors here are separate programs linked by socketnot in-process function calls although we aren' going to get into enough socket details in this to fully explain this script' codethere are few fine points worth underscoring herethis example should probably be augmented to detect and handle an end-of-file signal from the spawned programand then terminate its timer loop the non-gui script could also start the gui insteadbut in the socket worldthe server' end (the guimust be configured to accept connections before the client more ways to add guis to non-gui code