Jump to content
  • Advertisement
Sign in to follow this  
Ezbez

installing PySFML - and why I'm falling in love with it

This topic is 3540 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[Edit: IMPORTANT NOTE: This is deprecated. This worked with PySFML version 1.3. It does not work with 1.4. I do not currently have the correct instructions for PySFML 1.4 installation, sorry. The documentation for 1.3 should have been updated to now be correct, but the documentation for 1.4 still doesn't seem to work.] Wow, I haven't been this impressed with a library in a while. SFML is a very complete and well-made library. It's got language bindings to Python and .NET, among others. It's got decent documentation. It's got all you need to make a solid game. It works seamlessly with py2exe. And most of all, it really lives up to it's name: "Simple" is the key here. I encourage everyone to check out its website. But enough of the praise, surely there's something bad with it? Yes, the installation instructions for PySFML didn't work for me. I'm providing alternative ones here (ones that, you know, don't tell you to execute files that aren't there, and things like that [grin]). I'm also giving some instructions for working with py2exe, just because it's really nice how everything works without any duck tape.

How to install PySFML:

I did this to install PySFML 1.3 on a Python 2.5 installation. The instructions on the website don't work. In short, they tell you to download the dev files, but then give you instructions that only work on the source code. These are my instructions for installing the dev files, which is almost certainly the easier way to go. 1. Download the development files. You'll have to scroll down the to "Python" section and choose Windows or Linux. 2. Extract the downloaded file. 3. Navigate to the PySFML folder in /python/build/PLATLIB/ 4. Get libsndfile (a dependency of SFML). Download the precompiled binaries here. Extract that, and place the libsndfile-1.dll file into the PySFML folder. I assume that Linux users have to compile from source for this part. 5. Now you should successfully have PySFML running, but it's not yet globally accessed. Try making the "hello world" sample on the website and putting that in the PLATLIB folder and running it. It should work. 6. To make PySFML visible to any python program via import, you have to go to your python installation, then go to the Lib\site-packages\ folder. Generally this is all at C:\Python25\Lib\site-packages\ on Windows. 7. Copy the entire contents of the PLATLIB folder to site-packages. You'll have a PySFML folder and a .egg-info file inside site-packages/ 8. Now try that hello world program from anywhere and see if it works!

Turning a PySFML program into a .exe

So you want to make not only a pySFML program that you can run, but one that can run on any computer? This is the place for you, though I have to admit that I haven't actually tried the produced .exe on another machine. These instructions shouldn't be necessary for most people; PySFML works perfectly with py2exe, so you should be able to figure it out. But nonetheless: 1. Donwload and install py2exe. This part is documented on its website. 2. Do the "hello world" tutorial for py2exe and get somewhat familiar with it. 3. Change your setup.py so that it has your PySFML program instead of the Hello World program. Do this by replacing setup(console=["hello.py"]) with setup(console=['pysfmlProgram.py']), where "pysfmlProgram.py" is the name of your PySFML-powered python program. 4. run "python setup.py py2exe" 5. Copy the libsndfile-1.dll from step 4 of the "installing PySFML" instructions above into the dist folder which your setup program created. 6. Run pysfmlProgram.exe in the dist folder and revel and see if it works! So I hope those help someone out a bit. I'm posting this in the hopes that some poor fool will throw their fate to the Google gods and find some aid in their time of need from this. Or something like that. Anyways, both of these have only been tested by me, on one computer, and only in Python 2.5. I am not a lawyer and have no clue what rights you have for the distribution of the files inside of the dist folder that the setup.py creates. Check the licenses of all the files in there before you try give it to people. Also, is the wiki a good spot to put quick, mini-tutorials like this? [Edited by - Ezbez on May 1, 2009 8:28:19 AM]

Share this post


Link to post
Share on other sites
Advertisement
Thank you very much for your feedback.

I'll inform the author of the python binding, and we'll update the tutorial accordingly.

If you're looking for a place to write such things, you can also use the SFML wiki ;)

Share this post


Link to post
Share on other sites
Good to hear that. I'll definately have to get an account on the SFML wiki, since this is a project I'd really like to support.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!