Stdout and stderr

I realise that if I have app = wx.App(False) in my script all errors and print statements go to the console.
Also if I set it to True they go to a window.
How can I change this programatically, so I can make an option in my gui to select either mode?
Thanks.

Try calling RedirectStdio() on your wx.App object?

https://docs.wxpython.org/wx.App.html?highlight=wx%20app#wx.App.RedirectStdio