Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Help with PySFML  (Read 5525 times)

0 Members and 1 Guest are viewing this topic.

iUnknown

  • Newbie
  • *
  • Posts: 3
    • MSN Messenger - iUnknown57@hotmail.com
    • View Profile
    • http://www.david.planetofhosting.net
Help with PySFML
« 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
------------------------------------------
12/1 - The start of my Game Engine
------------------------------------------

Zerralin

  • Newbie
  • *
  • Posts: 5
    • View Profile
Help with PySFML
« Reply #1 on: November 29, 2011, 07:30:31 pm »
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

kolofsson

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Help with PySFML
« Reply #2 on: November 29, 2011, 09:05:12 pm »
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.

thisdyingsoul

  • Newbie
  • *
  • Posts: 12
    • View Profile
Help with PySFML
« Reply #3 on: November 30, 2011, 02:40:04 am »
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

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Help with PySFML
« Reply #4 on: November 30, 2011, 03:47:06 am »
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

Quote from: "Zerralin"
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.

Quote from: "kolofsson"
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.

Quote from: "kolofsson"
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.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

iUnknown

  • Newbie
  • *
  • Posts: 3
    • MSN Messenger - iUnknown57@hotmail.com
    • View Profile
    • http://www.david.planetofhosting.net
Help with PySFML
« Reply #5 on: November 30, 2011, 06:13:40 am »
I really appreciate the links but I have python 3.2.
Is it possible to get PySFML for 3.2?
------------------------------------------
12/1 - The start of my Game Engine
------------------------------------------

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Help with PySFML
« Reply #6 on: December 21, 2011, 05:19:31 pm »
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.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

iUnknown

  • Newbie
  • *
  • Posts: 3
    • MSN Messenger - iUnknown57@hotmail.com
    • View Profile
    • http://www.david.planetofhosting.net
Help with PySFML
« Reply #7 on: December 21, 2011, 08:57:26 pm »
You're fine I just decided to skip Python for now and learn more C++ Thank you tho.
------------------------------------------
12/1 - The start of my Game Engine
------------------------------------------

mathninja

  • Newbie
  • *
  • Posts: 2
    • View Profile
Coping Sprites - PySFML (cython)
« Reply #8 on: January 14, 2012, 12:38:36 am »
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?)

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Help with PySFML
« Reply #9 on: January 14, 2012, 01:32:52 pm »
Is it possible in C++? As far as I can tell, there's no copy constructor.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6267
  • Thor Developer
    • View Profile
    • Bromeon
Help with PySFML
« Reply #10 on: January 14, 2012, 02:17:25 pm »
Quote from: "bastien"
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...
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Help with PySFML
« Reply #11 on: January 14, 2012, 07:10:04 pm »
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.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

mathninja

  • Newbie
  • *
  • Posts: 2
    • View Profile
Help with PySFML
« Reply #12 on: January 15, 2012, 05:51:50 am »
Quote from: "bastien"
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.

 

anything