gui server sideread and display non-gui script' output import sysos from socket import including socket error from tkinter import tk from pp launchmodes import portablelauncher from pp gui tools guistreams import guioutput myport sockobj socket(af_inetsock_streamsockobj bind((''myport)sockobj listen( gui is serverscript is client config server before client print('starting'portablelauncher('nongui''socket-nongui py -gui')(print('accepting'connaddr sockobj accept(conn setblocking(falseprint('accepted'def checkdata()trymessage conn recv( #output write(message '\ 'print(messagefile=outputexcept errorprint('no data'root after( checkdataroot tk(output guioutput(rootcheckdata(root mainloop(spawn non-gui script wait for client to connect use nonblocking socket (false= don' block for input could do sys stdout=output too if readyshow text in gui window raises socket error if not ready print to sys stdout check once per second socket text is displayed on this start example - ' file to launch this example when both the gui and the nongui processes are runningthe gui picks up new message over the socket roughly once every two seconds and displays it in the window shown in figure - the gui' timer loop checks for data once per secondbut the non-gui script sends message every two seconds only due to its time sleep calls the printed output in the terminal windows is as follows--"no datamessages and lines in the gui alternate each secondc:\pp \gui\toolssocket-gui py starting nongui accepting accepted no data no data no data no data more gui coding techniques