Monday, January 14, 2013

Tutorial : Starting Off with Python and Pyglet


Hi,

Configuring python with Pyglet is very easy. Many of you might be wondering, why I have chosen Pyglet over Pygame. I have done a significant research around this, what I found that the people are increasingly accepting pyglet over pygame due to many of its benefits. StackExchange is one the most reputed dev forum, people there are recommending pyglet over pygame.
http://stackoverflow.com/questions/370680/differences-between-python-game-libraries-pygame-and-pyglet
http://stackoverflow.com/questions/1260108/start-with-pyglet-or-pygame. 



So, I started off with pyglet.

Configuring Python and Pyglet:
Download Python 2.7.3 from here and install.
I have tried it with python 2.7.3, I haven't tried python 3 version, but I hope it will work fine.
After installing, it will create Python27 directory in you C:\ . Check that python executable path has been added in th path environment variable of the window. This link will help you with that. If you can't find C:\python27; in the path variable, then add it.
Download Pyglet from here . In my case, .msi installer was not detecting python, so I chose the zipped file. You can download the .msi and see whether it works for you or not. Extract the zip at C:\, it will create a folder with the name 'pyglet-1.1.4'.
Now open cmd, execute the commands :
cd C:\pyglet-1.1.4
python setup.py install
 
It should install pyglet without any errors, if there is any you have to debug it.

Next, you can start making asteroids game following the awesome tutorial  by Steve Johnson where he explains nicely how should the folders, resources and programs should  be arranged for a game or application development. You can refer his github page, if you don't get his code right. I had some problems while referring his tutorial, where I wasn't sure in which py file a particular code will go. At that point, I referred github page.
You can also check pyglet programming guide.
In my opinion, this is enough to get into pyglet, moreover; you shouldn't deny the power of google.

No comments:

Post a Comment