Best way to handle c++ and python program

closed account (423hURfi)
I want to write as much of my game in python as possible, using c++ to handle graphics and low level stuff. What would be the best way to handle this? Can I run my main game loop in python and make calls to c++ methods when the screen needs to be updated and drawn? Or should I have the main game loop in c++ and just have it make calls to python methods and objects? Which would be better and/or more efficient?

For clarification, everything related to game data would be in python, not just data manipulation algorithms. So classes and their methods would be in python too.
Why aren't you using a ready-made library for this? It would save you all the grief of handling graphics in C++ and interfacing with Python.

SFML http://www.python-sfml.org/
SDL http://www.pygame.org/
DirectX http://directpython11.sourceforge.net/
closed account (423hURfi)
I'm fully aware of these libraries but I like to learn the basics the hard way first to really get familiar with how things work, even if its completely different then how it would work in the library. I only intend to build a small part of the game like I mentioned above, then do the whole thing with pysfml(which I have had for like two months now). I just like to experiment with ideas and it doesn't hurt to put these experiments in my portfolio. I'm just asking for a kick in the right direction, which in this case would be to simply answer my original question.
Well, presuming you're smarter than the rest of us...

There is no efficiency trade-off to calling between C++ and Python stuff. Keep all your time-sensitive, number-crunching code in C++ and everything else (event loop, etc) in Python.

Good luck with the graphics library!
Topic archived. No new replies allowed.