[Tutor] graphics library for teaching Python

Michael Mossey michaelmossey at gmail.com
Thu Dec 20 23:16:52 EST 2018


I'm a computer science tutor and I'm asking advice about a graphics or game
library that can be used with Python effectively for teaching purposes.

I've found that having my student pick a long-term project is a good way
for them to learn coding, and graphics or games make great projects that
both have stimulating results and bring computer-science-y topics into the
mix (i.e. they are natural vehicles for OO, data structures, and
algorithms).

There are two sub-topics I'm interested in - (1) graphics, as in drawing
interesting pictures or art, or using diagrams for data visualization. (2)
Simple games, with the use of sprites.

I've been using PyGame, but I'm not happy with it. It's not very well
organized or documented, and not very capable of general graphics.

So I'm looking into a few other possibilities. No library can be everything
to everyone, but I'd  like something that gives students exposure to a
variety of programming tasks, like constructing GUIs, events and event
loops, and 2-D graphics via stroking and filling common polygon shapes and
Bezier curves. (3D is not necessary for now.)

Here are some alternatives to PyGame:

- Pyglet. Doesn't look promising. I'm mainly interested in 2D, and I don't
see common data visualization tasks provided like filling and stroking
Bezier curve shapes (maybe I'm missing something).

- Cairo. Looks great for static 2D graphics, but not games .. again maybe
I'm missing something.

- Cocos2D. Good for games but not necessary general 2D graphics.

- PyQt. I used this extensively at my last regular desk job many years ago,
and if I recall it has the QCanvas element with pretty deep graphics
ability and also event handling. It has collision detection too, I think,
allowing for easy 2D game writing.

It looks to me like PyQt is the most capable program and most related to
what I want to do, but one thing I'm wondering about is how widely its used
and whether it would be good exposure for students to connect them to the
wider world of computing they will someday enter.

Any thoughts would be appreciated.

Mike


More information about the Tutor mailing list