Starting in Python: best graphics module?

Started by
17 comments, last by pyirrlicht 12 years ago
I've seen a few different graphics modules floating around, and I was wondering if there's some consensus on which is the easiest to understand/most flexible/whatever. I'm looking to get started on a basic 2D project. Thanks!
Advertisement
Hi, totheteeth.

I suggest you try this one: http://www.ogre3d.org/tikiwiki/PyOgre

It is very well suited to beginners.

Any more info, just ask.

- Mikey
I haven't used Ogre, but it looks a bit heavy for a basic 2D project. Maybe also have a look at PySFML.
Hi, kloffy.

Ogre is one of the most basic graphics modules for beginners to use in Python.

I use it to teach my students, and even those not native to programming basics pick up fast on it.

It is very well suited for basic 2D projects, and it is not "heavy" as you're making it seem.

20+ years of programming experience and teaching.

- Mikey
If you're saying that getting an image up on the screen with PyOgre is as easy as this:

from PySFML import sf

def main():
window = sf.RenderWindow(sf.VideoMode(800, 600), "SFML Sprite")

image = sf.Image()
if not image.LoadFromFile("image.png"):
return

sprite = sf.Sprite(image)

while window.IsOpened():
event = sf.Event()
while window.GetEvent(event):
if event.Type == sf.Event.Closed:
window.Close()

window.Draw(sprite)
window.Display()

if __name__ == '__main__':
main()


I'm going to have to take your word for it. Like I said, not much experience with Ogre3D on my side...
Hi again, kloffy.

It only takes about 14 continuous non-break code lines to perform the same thing.

- Mikey
I recommend Pygame (http://www.pygame.org).

It's a great library that is very easy to use. There's a lot of documentation, including a few free books, to get you going.
PyGame is popular, well documented, and well suited to a basic 2d game.
PySFML (suggested above) could also be a good choice, although you'll find less reference materials available than you would for PyGame; there is however an active and helpful community of SFML users who can offer assistance.
You might also consider pyglet if neither of the above interest you.

I would agree with kloffy's suggestion above that PyOgre might not be the best choice; it's certainly a very capable option, and would not involve much more work than alternatives to do 2d work, but it certainly is a "heavier" option than the pure 2d libraries available. A lot of the available documentation is also focussed on 3d applications, and you'll find less 2d examples available. This is a library that is not strictly intended for 2d usage, with documentation aimed at 3d programming; it would do what you need, but the other libraries suggested here are meant for 2d, and have documentation and examples focussed on that usage.


@Mikey: PyOgre is certainly suitable for 2d applications, and I'm sure your students have had a good experience with it, but remembering that totheteeth does not have a teacher walking him through examples in a classroom environment, and that his stated goal is to "get started on a basic 2d project" do you really think it's better than a dedicated 2d library with dedicated 2d documentation and samples? Really?

- Jason Astle-Adams

Hi, jbadams.

Define "heavier".

I have freely available tutorials for absolute beginners in game programming to get a window started up and get images and functions going. Any documentations can be provided solely by me, and are written by me.

I can assure you that with the right pointers, and not saying PyGame nor PySFML are not essential or good, but I've always relied heavily on PyOgre for beginners and can tell you from years of experience that its engine is more forward, able to establish a better interface, and less error prone. Perhaps we should consider what the engine can do rather than how well it's suited to document proper use. Again, not saying that either of the options recommended before are bad, but please keep in mind and an open mind to the suggestions of others.

Certainly it would be best to describe what you mean by the terms you use as well, throwing around word such as "heavy", but I'll just let things slide for now since I believe you're an honest person and willing to compensate consideration for my efforts here.

@flembobs

I suggest you take an appropriate measure and consideration for another person above you's opinion rather than gloating about your recommendation. Thank you.

- Mikey
Ok, that's fair, I wasn't very specific in my objections.


The original poster wants to create a 2g game. PyGame and PySFML are meant for 2d usage, and they provide functionality intended specifically for that usage and have documentation intended specifically for that usage. PyOgre is capable of 2d but is primarily meant for 3d. It provides a lot of 3d functionality that is simply of no use to the OP, and the overwhelming majority of the documentation is for 3d rather than 2d.

The original poster is a beginner, and will probably run into cases where help is needed. A lot people using PyGame and PySFML will also be doing 2d applications and will be able to offer help and examples that are directly applicable. The majority of people using PyOgre will be creating 3d applications, and would therefore only be able to offer general suggestions (and probably won't have any examples on hand) to a 2d user.

A search for additional resources about PyGame and PySFML turns up lots of 2d material. A search for additional resources about PyOgre turns up lots of 3d material.


You mention that you provide some tutorials yourself -- but you haven't provided a link. Your tutorials don't really factor in if the OP hasn't been told where they are. Additionally -- without meaning to be impolite -- you've mentioned years of experience, but haven't given much reason to be confident in your abilities in your recent posts, where you disagree with the correct and intended usage of a smart pointer without explaining why (and you'll note your suggestion is apparently very unpopular given the down-votes), and apparently don't have a properly set of development machine and seem to show a poor understanding of DirectX model loading.

I'll quickly apologise for what could be perceived as a personal attack, but I believe your experience is directly relevant given that you're saying the OP should rely on tutorials you have written.



please keep in mind and an open mind to the suggestions of others.

I believe I have done so. In my first reply, I acknowledged that PyOgre is very capable as a 2d option; but I feel that it might not be the best choice given the 2d-specific options. In my second reply I've clearly stated why I think the 2d-specific options might be a better fit. Perhaps it's your turn to keep an open mind to the suggestions of others?


@flembobs

I suggest you take an appropriate measure and consideration for another person above you's opinion rather than gloating about your recommendation. Thank you.

What are you on about? He just suggested an appropriate library that had not yet been mentioned, and made no mention what-so-ever of the posts above.

- Jason Astle-Adams

This topic is closed to new replies.

Advertisement