SFML community forums
Bindings - other languages => Python => Topic started by: iUnknown on November 29, 2011, 03:22:46 am
-
I have spent at least three hours trying to figure out how to combine Python and SFML and I just can't do it and I'm irritated..
Can someone please give me step by step instructions?
I have Python 3.2
I also have a 64-bit computer
Thanks in advance,
David
-
Hello, this is not official but this is how i do
1] Installing MinGW(http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/mingw-get-inst-20111118/)
2] Adding MinGW\bin to WINDOWS path(can be added temporary)
4] getting sfml2 by git.
3] Installing cmake
5] launch cmake-gui, select sfml2-source-dir and sfml2-build-dir. Select the mingw generator and Configure->Generate.
7] now alt+r -> cmd -> cd sfml-build-dir -> mingw32-make -> mingw32-make install(as admin)
8] go to sfml_install_dir and copy directories "include" and "lib" to mingw_install_dir.
copy the dll inside bin to windows/system.
Now SFML should works..
PySFML
9] installing python 3.2 32bits
10] installing cython (http://www.lfd.uci.edu/~gohlke/pythonlibs/#cython) Cython-0.15.1.win32-py3.2.exe
11] Create distutils.cfg in C:\Python32\Lib\distutils\ if not exists and add
[build]
compiler=mingw32
12] In C:\Python32\Lib\distutils\cygwinccompiler.py from the class MinGW32CCompiler remove all -mno-cygwin
13] Now try to install : alt+r -> cmd -> cd pysfml and
python setup3k.py build_ext
and finally
python setup.py build_ext install
good luck
-
I don't understand why anybody who has windows should bother to compile SFML and PySFML on his own. It's that stupid linux obsession to compile everything. Give us one lib pack for windows and it will work. I think using MinGW is bad. Python was compiled in VC++ 2008.
I have complete PySFML2 libs compiled for Python 2.7 if you want.
-
I tried to compile on windows too with no success..
But Bastien already help us :D
https://github.com/downloads/bastienleonard/pysfml2-cython/python2-sfml2-cython-win32.zip
-
I have uploaded a new zip that should contain the compiled binding and all the dependencies: https://github.com/downloads/bastienleonard/pysfml2-cython/python2-sfml2-cython-win32-nodeps.zip
Hello, this is not official but this is how i do
1] Installing MinGW(http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/mingw-get-inst-20111118/)
2] Adding MinGW\bin to WINDOWS path(can be added temporary)
4] getting sfml2 by git.
3] Installing cmake
5] launch cmake-gui, select sfml2-source-dir and sfml2-build-dir. Select the mingw generator and Configure->Generate.
7] now alt+r -> cmd -> cd sfml-build-dir -> mingw32-make -> mingw32-make install(as admin)
8] go to sfml_install_dir and copy directories "include" and "lib" to mingw_install_dir.
copy the dll inside bin to windows/system.
Now SFML should works..
PySFML
9] installing python 3.2 32bits
10] installing cython (http://www.lfd.uci.edu/~gohlke/pythonlibs/#cython) Cython-0.15.1.win32-py3.2.exe
11] Create distutils.cfg in C:\Python32\Lib\distutils\ if not exists and add
[build]
compiler=mingw32
12] In C:\Python32\Lib\distutils\cygwinccompiler.py from the class MinGW32CCompiler remove all -mno-cygwin
13] Now try to install : alt+r -> cmd -> cd pysfml and
python setup3k.py build_ext
and finally
python setup.py build_ext install
good luck
The --compiler option doesn't work with Python 3? It's shown in the options list when I use build_ext --help.
I don't understand why anybody who has windows should bother to compile SFML and PySFML on his own. It's that stupid linux obsession to compile everything.
SFML 2 has no binary release, so I didn't want to make binary release unless necessary. The vast majority of Linux users never compile anything.
I think using MinGW is bad. Python was compiled in VC++ 2008.
The packager obviously had to choose one compiler, it doesn't mean that the others are bad.
-
I really appreciate the links but I have python 3.2.
Is it possible to get PySFML for 3.2?
-
I have uploaded two new binary releases, for Python 2 and Python 3: https://github.com/bastienleonard/pysfml2-cython/downloads. Sorry for the delay.
Feedback is welcome.
-
You're fine I just decided to skip Python for now and learn more C++ Thank you tho.
-
Is there any facility to copy a sprite (That is create a new sprite with a reference to the same texture and all the same transformations?)
-
Is it possible in C++? As far as I can tell, there's no copy constructor.
-
Is it possible in C++? As far as I can tell, there's no copy constructor.
Yes. There's no need for a handwritten copy constructor, the compiler implictly generates one.
The Big Three should only appear explicitly in a few low-level classes. The need to write them all the time indicates a possible design flaw, namely the lack of value semantics for member variables. This just as an aside...
-
The default copy constructor may also be disabled, so I can only trust the documentation (since I was too lazy to read the source code). :)
Looks like I should add a copy() method, and maybe __copy__() too.
-
The default copy constructor may also be disabled, so I can only trust the documentation (since I was too lazy to read the source code). :)
Looks like I should add a copy() method, and maybe __copy__() too.
Well I tried using both copy.copy() and copy.deepcopy() on a sprite and the result appears to be the same as using sf.Sprite() to generate a new object.