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). http://www.pygame.org/news.html
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 http://www.pyglet.org/doc/programming_guide/the_opengl_interface.html .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 -> http://www.python-sfml.org/
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 https://pysfml2-cython.readthedocs.org/en/latest/ is the up to date binding for python and SFML

and http://www.python-sfml.org/ that one I believe is no longer being developed from what I have read here http://en.sfml-dev.org/forums/index.php?topic=4608.0

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 http://sfml-dev.org/ 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
@Zereo:

Are you sure? I think it's the other way around, according to http://sfml-dev.org/download/bindings.php
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 (http://sfml-dev.org/tutorials/1.6/start-python.php - 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 -> http://www.python-sfml.org/ is actively developed, but
I'm not sure about this -> https://pysfml2-cython.readthedocs.org/en/latest/
Last edited on
Topic archived. No new replies allowed.