How to use python with C++

Ok so I want to use python with C++ for graphics but where do I get all of the materials? Does Python come with a graphics library or do I have to download one? if I do where do I get it from? Which one is the best? Also im pretty sure python wont work with Code::Blocks but if it does that will be awesome, but I doubt it will work so what compiler do I use? I can find and download the Python language but can you tell me what graphics library to use and what compiler to use if i cant use CB. Thanks.
Use pygame for graphics library (python).
closed account (3qX21hU5)
I would actuallu recommend pyglet over pygame it is much better structured in my opinion and it is easier to use openGL with pyglet .Python is also a interpreted language (though it can be compiled to byte code) so you won't need a compiler just your favorite text editor and the python interpreter.

As for combining python and C++ there is plenty of tutorials out there about integrating python code into a c++ application and also the other way around.

And if you need any help getting things set up or understanding something in python I would be glad to help just send me a pm.
You should definitely, without question, use Boost.Python if you want to integrate Python and C++, it's excellent, although it's better for extending Python with C++ than the other way around (extending C++ with Python).
closed account (3qX21hU5)
pySFML2 is no longer being updated (At least that is what I heard) and has a good amount of bugs in its current release or else it would be my go to graphics library for python also. Wish it took off and was still being updated cause I love SFML and SFML for python would be awesome.

EDIT: Opps ignore this post was thinking about pySFML instead ;p. From looking at the documentation looks like pySFML2 is from a different developer(s) continuing the orginal pySFML project.
Last edited on
Ah, my bad. I thought it was the official binding. This then ->
closed account (3qX21hU5)
Opps actually you were right r0shi and I was wrong. I was orginally thinking of pySFML which is the one you just linked.

And just so it is clear for everyone is the up to date binding for python and SFML

and that one I believe is no longer being developed from what I have read here

Last edited on
Haha, we were both careless. I just typed 'pysfml 2' on google and posted the first result.
Didn't bother to visit first...

EDIT: It's a good thing this happened though. Now, whoever reads this thread will know
the difference between pySFML 2 and the official binding and will not fall for the google trap.
Last edited on

Are you sure? I think it's the other way around, according to
Last edited on
closed account (3qX21hU5)
Hmm you might be right. Now I am all confused lol.
It looks like there are 3 python bindings for SFML. The first one ever made is probably the one you (probably correctly) thought was abandoned ( - this module's name is PySFML, while the more recent ones are both named sfml). The second one is the one in the first link I posted, and the third one is the one currently on the SFML bindings page.

I'm pretty sure this -> is actively developed, but
I'm not sure about this ->
Last edited on
Topic archived. No new replies allowed.