Adventures in Python

posted in: GCW Zero | 0

I have heard many good things about python, but I haven’t had the chance to use it yet. The last time I did ended up being a miserable experience. Looking back at it, I think it had to do with the IDE I was using and the project I was working on. When I first worked with python I was using eclipse.

This past year I participated in HackVT, a 24 hour hackathon to make a killer Vermont app. It was at this event I was reintroduced into python through a friend and introduced to a very nice IDE called pycharm by JetBrains. That experience with python was a 1000 times better than my previous experience.

Now that I have a little more free time I decided to take another stab at python, this time with pygame. And to top it off, I still have my GCW Zero that supports python and pygame, so why not just make a small project to get me familiar with the aspects of pygame?

I present to you, Python Pong, or PYNG.


It’s a very basic 2 player pong game on the GCW Zero, but it allowed me to get acquainted more with python and pygame. I experimented with pythons inheritance, importing, as well getting input working on the device as well as music and sounds. At the end of it I also got experience of packaging an OPKĀ and putting it on to the device via FTP.


Handling input was one part of the process I wasn’t sure at first how to do with the GCW. Luckily, Pygame has hooks to SDL so the keys match up. So I just needed to make the correct calls in python and match it with this chart for SDL to match the keys to the buttons.

        #input calls used
        [pygame.key.get_pressed()pygame.K_ESCAPE] != 0:
        pygame.key.get_pressed()[pygame.K_RETURN] != 0:
        #Dpad up
        pygame.key.get_pressed()[pygame.K_UP] != 0:
        #dpad down
        pygame.key.get_pressed()[pygame.K_DOWN] != 0:
        #Y button
        pygame.key.get_pressed()[pygame.K_SPACE] != 0:
        #B button
        pygame.key.get_pressed()[pygame.K_LALT] != 0:

The code and the OPKs can be found on my GitHub.

Though I had my fun with python on the GCW Zero, I think I want to continue GCW development with SDL and C++ and see what I can do with it beyond getting a simple program running on the device.