adamlwgriffiths / cyglfw3

Cython bindings for GLFW3
Other
20 stars 6 forks source link

python3.4 support #14

Closed keksnicoh closed 8 years ago

keksnicoh commented 9 years ago

there is only python 2.7 support, would be very nice when this library could run in python3.*

adamlwgriffiths commented 9 years ago

Unfortunately, I don't use python 3. I'm also very busy at the moment.

Could you build the library and paste any errors you receive? If not, it will have to wait until I get some free time.

keksnicoh commented 9 years ago

Heyho, after my exams I will try and give you Feedback ;) Greetz

Am 23.06.2015 um 02:30 schrieb Adam Griffiths notifications@github.com:

Unfortunately, I don't use python 3. I'm also very busy at the moment.

Could you build the library and paste any errors you receive? If not, it will have to wait until I get some free time.

— Reply to this email directly or view it on GitHub https://github.com/adamlwgriffiths/cyglfw3/issues/14#issuecomment-114312039.

Emilgardis commented 8 years ago

When passing str objects as title of a window generates a TypeError. It is expecting a byte object in 3.x. Easily fixed by ommiting the char* tag in the CreateWindow function (and wherever this is needed) and adding a function that always returns bytes.

adamlwgriffiths commented 8 years ago

"and adding a function that always returns bytes." Not sure what you mean by this.

Can you do a pull request? I can then check it with python 2.7.

Need to try and setup TravisCI which would make this a lot easier.

Emilgardis commented 8 years ago

Basically whenever you pass a basic str object defined like title = "foo", passing title to the title arg in cyglfw3.CreateWindow will raise a TypeError: expected bytes, str found. Simply adding changing the string to a bytes object fixes this. For example: Line 15 in examples/gl4_1.py needs to be changed to window = glfw.CreateWindow(640, 480, b"Hello World") in order to work.I believe defining something as simple as a function that take in either a str or a bytes object and always return a str object would fix this. I'm not familiar with cython but I'll try to implement it and pull request.

adamlwgriffiths commented 8 years ago

Merged and tested on 2.7 and 3.4

adamlwgriffiths commented 8 years ago

Tagged in git and released as 3.1.0.2 on PyPi