I'm programming a GUI for pyinstaller. As part of the GUI, I would like to redirect the output of running PyInstaller.__main__.run(['--onefile', 'foo.py']) to a wx.TextCtrl. 
I first went about this by writing a class StdoutRedirector:
class StdoutRedirector(object):
    def __init__(self, outputwidget):
        self.out = outputwidget
    def write(self, text):
        self.out.WriteText(text)
Now this works fine for use with the print statement, but not with pyinstaller, which still prints to the terminal. Now I know pyinstaller uses the logger module for output, but I thought that went through sys.stdout. 
Can anybody help me solve how to redirect this output to a textctrl widget?