input shows up on the input pipedef callback(filemask)read from file here import _tkintertkinter _tkinter createfilehandler(filetkinter readablecallbackthe file handler creation call is also available within tkinter and as method of tk instance object unfortunately againas noted near the end of this call is not available on windows and is unix-only alternative avoiding blocking input calls with non-gui threads as far more general solution to the blocking input delays of the prior sectionthe gui process might instead spawn thread that reads the socket or pipe and places the data on queue in factthe thread techniques we met earlier in this could be used directly in such role this waythe gui is not blocked while the thread waits for data to show upand the thread does not attempt to update the gui itself moreovermore than one data stream or long-running activity can overlap in time example - shows how the main trick this script employs is to split up the input and output parts of the original redirectedguishellcmd of the guistreams module we met earlier in example - by so doingthe input portion can be spawned off in parallel thread and not block the gui the main gui thread uses an after timer loop as usualto watch for data to be added by the reader thread to shared queue because the main thread doesn' read program output itselfit does not get stuck in wait states example - pp \gui\tools\pipe_gui py ""read command pipe in thread and place output on queue checked in timer loopallows script to display program' output without being blocked between its outputsspawned programs need not connect or flushbut this approaches complexity of sockets ""import _thread as threadqueueos from tkinter import tk from pp gui tools guistreams import guioutput stdoutqueue queue queue(def producer(input)while trueline input readline(stdoutqueue put(lineif not linebreak def consumer(outputrootterm='')tryline stdoutqueue get(block=falseexcept queue empty gui coding techniques infinite size ok to blockchild thread empty at end-of-file main threadcheck queue times/secok if empty