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.


closed as not a real question by Laurent Couvidou, jcora, MichaelHouse, 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.

  • \$\begingroup\$ 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. \$\endgroup\$ – Laurent Couvidou Oct 14 '12 at 21:08
  • \$\begingroup\$ 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. \$\endgroup\$ – jcora Oct 14 '12 at 21:18
  • \$\begingroup\$ 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. \$\endgroup\$ – michael.bartnett Oct 15 '12 at 1:29
  • \$\begingroup\$ 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? \$\endgroup\$ – tugs Oct 15 '12 at 19:47
  • \$\begingroup\$ @tugs I don't think I could add much more useful information than what's already out there: 0, 1, 2, 3 \$\endgroup\$ – michael.bartnett Oct 15 '12 at 23:04

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.


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