Redirecting stdout and stderr to a PyQt4 QTextEdit from a secondary thread Redirecting stdout and stderr to a PyQt4 QTextEdit from a secondary thread multithreading multithreading