Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If embedding Pygame to C++ to have a game be an executable, is there any extra process I would have to use in order to use Pygame functions when embedding into C++? As opposed to just writing embedding code in C++ for normal Python code?

To clear cut the question I want to know if it's the same process without having to call different functions.

EDIT: My question is if I have to call different functions in C++ when embedding Python code that uses Pygame modules. I am NOT using pygame2exe nor py2exe. I never even mentioned those. My question is solely about code embedding.

share|improve this question

closed as not a real question by Laurent Couvidou, jcora, Byte56, doppelgreener, michael.bartnett Oct 15 '12 at 1:29

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

I don't understand what you're asking exactly. Are you wondering if you need to change Python function calls when using Pygame2exe? Please clarify your question. – Laurent Couvidou Oct 14 '12 at 21:08
Oh god that circularity... Anyway, I highly doubt this has anything to do with game development. If you're looking for a way to compile Python code, @LaurentCouvidou has your answer. – jcora Oct 14 '12 at 21:18
Why are you trying to embed Python with Pygame into C++? Just use SDL, since that's what Pygame is built on. Pygame is supposed to be the boss of the application. You can write C++ modules that are loaded from Python, but if you try to embed Python and scripts that depend on Pygame, you're gonna have a bad time. – michael.bartnett Oct 15 '12 at 1:29
I would like to see this question reopened and an answer from @michael.bartnett giving some details about the pitfalls of such an approach. If I wanted to use Python for 'scripting' inside of a game that's already mostly written in C++, would this not be the way to go? – tugs Oct 15 '12 at 19:47
@tugs I don't think I could add much more useful information than what's already out there: 0, 1, 2, 3 – michael.bartnett Oct 15 '12 at 23:04
up vote 2 down vote accepted

When you embed Python into C++, you just have to set up the code to call the Python functions in C++. The Python libraries that you use, such as Pygame, have no effect on the C++ binding code you need to use.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.