How do I direct output from a wxPython program

All Python programs can output text via two standard streams: the standard output stream, sys.stdout, and the standard error stream sys.stderr. An ordinary Python script directs the standard output streams back to the console from which the script was launched. However, when your application object is created you can decide to have wxPython take control of the standard streams and redirect the output to a window instead. This redirect behavior is the default behavior for wxPy-thon under Windows. In Unix systems, however, where there is more likely to be an actual console window, wxPython does not control the standard streams by default. In all systems the redirection behavior can be explicitly specified when the application object is created. We recommend taking advantage of this feature and always specifying redirect behavior to avoid any problems from different behavior on different platforms.

Was this article helpful?

0 -1

Post a comment