Python, Pyglet, Pygame and Py-Me
-
Which is better: Pyglet or Pygame? I'm moving into Python after too long with Java, and though I'm not looking to build a game or anything I have a project in mind in which I want to have some sort of canvas to draw on programatically, some way of playing sounds, etc. As a result, it seems like one of the game libraries probably offers the best option for getting it done. If that's not correct, please correct me! It seems like the big two are Pyglet and Pygame, and while I googled for a consensus first, there doesn't seem to be much of one and so I would like to gauge the responses from people on AskMe. I trust allyall more than I trust http://www.reddit.com/r/Python/comments/15lz1m/pygame_pyglet_something_else_entirely/, what can I say? So, for ease of development, utility, support, performance, whatever else you can think of, which one is the better option for putting sprites and lines on screen and doing cool things with input devices?
-
Answer:
I have used neither, but I've heard plenty of people talk about Pygame at Python user group meetings. Haven't heard of the other one.
barnacles at Ask.Metafilter.Com Visit the source
Other answers
I have tried both, although not for your exact use case -- I was trying to visualize data and results from my research. This was also a few years ago. At that point, Pygame's Mac support was atrocious, and it was much more library than I actually needed. (It looks like Pygame's Mac support may have improved since.) Pyglet was lighter-weight and much less of a pain to install. I don't use either of these libraries now. I just use GLUT and OpenGL through PyOpenGL, since the small amount of code that Pyglet saved me wasn't worth the extra dependency.
Serf
I think you have two more options worthy of consideration. Jython is a version of Python that runs on the JVM and should make it easy to create Java objects and call their methods. This would help you make use of your past Java experience, especially the library part. It seems to be active and well based on looking at the project homepage and noting last update from this year, but I have to admit I've never written a single line of code for it. I have a little experience with PyQt4, which is a Python binding of the cross-platform Qt GUI library. It has a canvas class for graphics, allows you to create OpenGL contexts for graphics, and has a multimedia component called Phonon for playing audio and video. If you are familiar with GUI programming concepts and idioms, the move from Java and AWT or Swing to Python and Qt will be conceptually simple, even though they are quite different in many details. I think it should work fine for your purposes, and I've never had trouble installing it on different OSes, apart from the annoyances different DLL versions sometimes cause on Windows. (Not a problem at all if you only install one version.) My recommendation would be to go with PyQt4 if you are happy with its documentation and the tutorials & books teaching it you that you can find. I don't have any particular recommendations for the latter, but you can do a web search. On the cons side, it might be needlessly big if you have only a modestly-sized project in mind.
tykky
Not giving an answer that you asked for, but when I looked to make the same decisions recently I decided to go with http://kivy.org. It's built on Pygame, but I found much more accessible and faster to just get stuff working. (Also it makes it easy to assemble cross-platform apps if that comes in handy.)
Ookseer
I've been tinkering with pyglet lately for lower level stuff like writing shaders. I like it, but the reddit thread is right about the small community. It's very rare I search for something and find an answer written after 2010. That being said, it did have a release last year which fixed their Mac support. So there does seem to be people working on it. To make your decision tougher, http://cocos2d.org/ was built on top of pyglet and might be more what you are looking for. I haven't used the python version, but the ObjectiveC port has been extremely popular for developing iPhone games.
Gary
Thank you to everyone who responded; even though I'm still in about the same position I was before, I quite appreciate your answers! Now, responding in turn to specific points: http://ask.metafilter.com/238851/Python-Pyglet-Pygame-and-PyMe#3464048: "Jython is a version of Python that runs on the JVM and should make it easy to create Java objects and call their methods. This would help you make use of your past Java experience, especially the library part. ... My recommendation would be to go with PyQt4 if you are happy with its documentation and the tutorials & books teaching it you that you can find." tykky, I appreciate this point, but for a number of reasons I've decided to leave Java and move on to Python as my go-to language. My development days are well in the past, at this point, and most of what I do involves straight Python, so I'd rather not split the bill (so to speak!). Beyond that, thanks for pointing out PyQt4 because (heh) I hadn't considered the drawing capabilities of something like Qt with a full widget set. I'll go ahead and investigate that, both for the project I currently have in mind and for things beyond! http://ask.metafilter.com/238851/Python-Pyglet-Pygame-and-PyMe#3464184: "Not giving an answer that you asked for, but when I looked to make the same decisions recently I decided to go with Kivy." Ookseer, I have been intrigued by what I'd seen of Kivy so far, but I was under the (apparently mistaken) impression it was primarily for touch-capable devices. It certainly looks pretty, though, and since it does desktop machines, as well ... well, crap, one more library to check into! :) However, the multitouch possibilities are already raising some ideas for me. In the end, I find myself drawn primarily by the idea that Pyglet is more Pythonic than Pygame, even if its support levels are not at the same level. I'm not looking to do anything outrageously difficult, and I like nicely designed APIs. I guess it's useful that there's not much consensus on one or the other, in that now I have to get off my ass and get into 'em both to investigate. To the internet!
barnacles
Related Q & A:
- What are the common usage of python programming language?Best solution by quora.com
- What is the difference between a static method and class method in Python?Best solution by pythoncentral.io
- how to zip similar files using python?Best solution by Stack Overflow
- How to add image to QTextBrowser using Python?Best solution by Stack Overflow
- How do I make a python web program that is on a ubuntu server allow access to the server?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.