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

Author Topic: pysfml-cython  (Read 91440 times)

0 Members and 3 Guests are viewing this topic.

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Re: pysfml2-cython
« Reply #120 on: August 05, 2012, 10:32:09 pm »
The default font has been removed, like in C++ SFML.

The Cython bug that required to edit the sfml.cpp file should be fixed with this commit, but I haven't been able to try it yet: https://github.com/cython/cython/commit/01adf0000e88b70eaf3a7315cfeaf80aa4e21bc1
I'm not sure whether this is included in the 0.17 beta.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Re: pysfml2-cython
« Reply #121 on: August 12, 2012, 07:31:56 pm »
The source releases have been updated. I have also created a “rc-compatible” branch that should work with SFML 2.0 RC. This branch has the same API, i.e. it's still BACK_SPACE instead of BACK and there's no default font. I'll upload RC-compatible source releases when I'm sure it actually builds with the RC. Could someone test it?
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Re: pysfml2-cython
« Reply #122 on: August 15, 2012, 10:43:03 pm »
I have uploaded the SFML 2.0 RC-compatible source.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

therocode

  • Full Member
  • ***
  • Posts: 125
    • View Profile
    • Development blog
Re: pysfml2-cython
« Reply #123 on: August 18, 2012, 03:13:25 pm »
How are you meant to install pysfml2-cython? On the documentation you have instructions for building the module, not installing. So I had to guess my way and I can't get it to work. :(

I am on windows 7 and downloaded the source. Then I tried to build the module by "python.exe setup.py built_ext" and I had sfml 2.0 installed from before. Then in the compile process it couldn't find SFML/graphics.h etc. So I had to edit the setup.py file and add a -IC:\program files (x86)\SFML\include to get it to compile. Then it didn't find the lib files when linking and I had to copy the sfml lib files to python27/libs. and _then_ it compiled.

But the problem when running was this:

Traceback (most recent call last):
  File "C:\projects\ponkt\mejn.py", line 3, in <module>
    import sfml as sf
ImportError: DLL load failed: The specified module could not be found.

and I opened the .pyd file in dependency walker and I could see that it didn't find sfml-graphics-2.dll etc. And I tried everything from copying them to the folder from where I ran the python application, into system32, changing PYTHONPATH etc etc and nothing seems to work and I am getting a bit frustrated. :( So I came here to ask if someone has a solution to this problem.

thanks in advance.

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Re: pysfml2-cython
« Reply #124 on: August 19, 2012, 06:11:50 pm »
I recommend using these installers that should work out of the box: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pysfml
They have been recently updated,  by the way.

For the headers and libraries directories, you can pass them as arguments to the setup.py script. I guess there's a mechanism such as environment variables to avoid having to pass them every time, but that's how I did it when I built the installers myself anyway.

For the DLL missing at launch problem, it can be very annoying because the loading of the DLL may fail because of some dependent DLL failing to load. I remember that I had to copy the correct OpenGL DLL in my current folder because the wrong one was being loaded. The problem disappeared when using the installer I just built.

To be honest, I almost never use Windows for programming, and I don't have a hard and fast for debugging this kind of problem.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Re: pysfml2-cython
« Reply #125 on: August 19, 2012, 06:36:15 pm »
I have changed the Github name from pysfml2-cython to pysfml-cython. This is probably going to create a lot of dead links, but I prefer to do it now than whenever pySFML 3 gets released.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

therocode

  • Full Member
  • ***
  • Posts: 125
    • View Profile
    • Development blog
Re: pysfml-cython
« Reply #126 on: August 20, 2012, 09:31:39 am »
The installers didn't work unfortunately. :/ They say I need python 2.7 installed and that it isn't in the registry. But I do have python 2.7 installed. And then I don't get to do anything. How do I get python registered?

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Re: pysfml-cython
« Reply #127 on: August 20, 2012, 01:29:40 pm »
Is it the same 32/64 bits version as the installer? I'll try the new installers to see if I get the same problem.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

therocode

  • Full Member
  • ***
  • Posts: 125
    • View Profile
    • Development blog
Re: pysfml-cython
« Reply #128 on: August 20, 2012, 01:55:32 pm »
Oh, I tried the 32 bit version now and it worked. :)

therocode

  • Full Member
  • ***
  • Posts: 125
    • View Profile
    • Development blog
Re: pysfml-cython
« Reply #129 on: August 21, 2012, 03:15:49 pm »
Hi again. xD

Well, I did as I said in the last post, get the installation to work. But it seems that there are more problems.
I am coding something with another person and we are collaborating with svn.

The problem we are having is that we can't even set up a window becasue it seems like stuff are missing from the SFML api. This is our code:

#-*- coding: utf-8 -*-i
import sfml as sf

window = sf.RenderWindow()
window.create(sf.VideoMode(800, 600), "title")
window.setFramerateLimit(60)

and we get the following error:

AttributeError: 'sfml.RenderWindow' object has no attribute 'setFramerateLimit'

So it is as if RenderWindow does not contain it. We tried different stuff and isOpen() is also missing from RenderWindow. So we try to use Window instead of RenderWindow. But then it says that the module doesn't have "Window". But it still has RenderWindow. So something is not right. xD

We are collaborating as said, and one of us is on linux and the other one on windows, and both have a quite fresh snapshot of SFML 2.0 and both have pysfml 0.2.1 and we are getting identical errors. Any ideas?

rojohound

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: pysfml-cython
« Reply #130 on: August 25, 2012, 10:50:42 pm »
@kaveldun
The naming is a bit different than the actual SFML api, but it's all in the documentation linked from the first page.  Instead of "setFramerateLimit" you would use "framerate_limit".

@bastien
Everything seem to be working great except I'm getting an error when using the image constructor.
>>> sfml.Image(100,100)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sfml.pyx", line 1833, in sfml.Image.__init__ (src\sfml.cpp:23432)
AttributeError: 'sfml.Image' object has no attribute 'stream'

therocode

  • Full Member
  • ***
  • Posts: 125
    • View Profile
    • Development blog
Re: pysfml-cython
« Reply #131 on: August 26, 2012, 09:36:26 pm »
Oh right. Thanks. xD

Didn't expect the API to be named differently.

trilavia

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: pysfml-cython
« Reply #132 on: December 15, 2012, 10:16:28 am »
Does this binding work fully with python 3.3? Or only python 2?

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Re: pysfml-cython
« Reply #133 on: December 25, 2012, 10:03:36 pm »
Github has removed the downloads feature: https://github.com/blog/1302-goodbye-uploads
For now, you can still access the old downloads with this URL (note that the installers are outdated and should be downloaded here): https://github.com/bastienleonard/pysfml-cython/downloads

Since Cython now builds the module without hassle, I think I'm going to stop packaging these source releases. (The goal was to make it so that you don't have to install Cython to build from the source. You can still download the source from Github, but you won't have the Cython-generated file.)
Do you think it was actually useful?

@bastien
Everything seem to be working great except I'm getting an error when using the image constructor.
>>> sfml.Image(100,100)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sfml.pyx", line 1833, in sfml.Image.__init__ (src\sfml.cpp:23432)
AttributeError: 'sfml.Image' object has no attribute 'stream'

Sorry, I only saw this part of your message now. It's fixed now.

Does this binding work fully with python 3.3? Or only python 2?

As far as I can tell, it should work fine. I'll test it as soon as I update my system.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

netrick

  • Full Member
  • ***
  • Posts: 174
    • View Profile
Re: pysfml-cython
« Reply #134 on: February 15, 2013, 03:16:12 pm »
Any chance for network module? I know that python itself has socketing library but sfml sockets are much more convenient. For example python-sfml2 has network bindings.

 

anything