File: pyedit-products/unzipped/PP4E/Gui/Tools/pipe-gui2-thread.py

# same but try thread for read/write loop to avoid blocking: not safe!

from tkinter import *
from PP4E.Gui.Tools.guiStreams import redirectedGuiShellCmd

#def launch():
#    redirectedGuiShellCmd('python -u pipe-nongui.py')

def launch():
    import _thread
    print('starting thread')
    _thread.start_new_thread(redirectedGuiShellCmd, ('python -u pipe-nongui.py',))

window = Tk()
Button(window, text='GO!', command=launch).pack()
window.mainloop()



[Home page] Books Code Blog Python Author Train Find ©M.Lutz