Jump to content
  • Advertisement
Sign in to follow this  
DirectXXX

Redirect std::cout to python (wxpython gui)

This topic is 4052 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have created a python module using Boost::Python. My GUI app is created using wxPython. I want to redirect the c++ std::couts from python module... to the python gui text area. Redirect should not affect the default std::cout behaviour of outputing to console window.

Share this post


Link to post
Share on other sites
Advertisement
You need to create a 'file-like object', and then assign that to the standard output stream in Python (I forget the name, something like sys.stdout). Then things like 'print' in Python will be written to your file-like object instead, and you can have that object do whatever you like with that data.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!