kirby urner wrote:
SO: Any recommendations as to course textbooks? Or just go with Zelle and/or O'Reilly's latest wood rat book? - The students presumably have had programming courses already. - I would think that K-12 students would be happier if they could generate some graphics. - This is a 6-weeks course. Little leisure time.
Appreciate any advice.
Peter Chase Sul Ross State University
I still like Zelle's best and includes some graphics (Tk-based, using his own graphics.py).
Some of the online tutorials are quite worthwhile as well: http://diveintopython.org/ is freely downloadable.
Or roll your own (that's what I've been doing).
Another way to get graphics is to write scene description language (POV-Ray) or even VRML from Python. I've used this approach successfully, but only because I give students access to prewritten modules. Like, we might build our own vector class, with a module that already expects to use vectors.
VPython is still more graphically exciting.
My fun this week in some sense involved some synthesis of these approaches - having come to a "what is possible" revelation. PyGeo uses VPython for vector graphics, and exports to POV-Ray - producing a high quality "still" of what one is observing on the screen. Except that I hadn't been able to find a way to reliably reproduce a representation of a flat plane in POV-Ray that closely resembled the PyGeo plane - which is just a mesh of thin lines (the vpytbon curve object)- exported to POV-Ray the lines showed too much of their thickness, and the illusion of flatness, essential to a plane was lost. I realized what *does* work is a image map of a line mesh - with appropriate transparencies - applied to a flat polygon, scaled and oriented appropriately in POV-Ray. But PyGeo allows one to apply any color to a plane. I would lose that in POV-Ray if I used a particular image map, or even some collection of them. Ah-ha. I now have PIL creating a the image map - transparencies and all - on the fly. One can have an unlimited number of plane objects represented in an unlimited number of colors created in POV_Ray, pretty reliably representing what one is seeing in the on screen rendering. There is about 10 lines of easy to follow code involved. Too much fun. Art