The actual problem seems to be here, if you change DoPythonStuff to
>this you don't get an error.
Sorry, I was wrong again.
If you replace pycrust with a wxButton, wxStyledTextControl, wxGrid, or whatnot it's all good. It has something to do with pycrust's Shell class and probably the internal interpreter. I added def __del__ to return the stdio redirection and delete the intrepreter to clean it up better without any luck. I checked their site (PyCrust download | SourceForge.net) and they have a significantly newer version which you may want to check out. I copied it over, but alas same error, even with added cleanup.
Well, it's good to know that wxPython can be easily embedded in c++ and that this problem is just an issue with a single widget (hopefully).
I suspect that you need to jump in before deleting the window to call shell.delete to shutdown the interpreter, but I'm not sure why.
-John Labenski