Best Python book(s) for a pre-teen?

Scott David Daniels Scott.Daniels at Acm.Org
Wed Feb 19 13:05:26 EST 2003


Another possibility:
Look into VPython (A CMU project):
	http://www.vpython.org/
It allows you to do 3-D geometry _very_ easily.  You build 3-d models,
and the system automatically provides a roll-around view of your
scene.  Very fun.  It should take _you_ an afternoon to get a fun
3-D shape going (if you are slow), and the motivation of seing these
shapes is, for me, great.
Here is a sample program:
	import visual
	vector, color = visual.vector, visual.color

	start = vector(4,7,3)
	finish = vector(4,2,3)

	box = visual.box(pos=finish, size=(8.,4.,6.), color=color.red)
	ball = visual.sphere(pos=start, radius=2, color=color.green)

	framespersec = 12
	seconds = 15
	startink = vector(color.blue)
	stopink = vector(color.red)
	for i in range(seconds * framespersec):
	    ball.pos = start + i * (finish-start)/100.
	    ball.color = startink + i * (stopink-startink)/100.
	    visual.rate(framespersec)

Running this slowly (in 15 seconds) pushes a blue ball (which
becomes redder over time) into a red box.  This is (to my way
of thinking) much more delightful than 2-D because you know how
to draw in 2-D more easily than the computer can, while the
computer can help you sketch in 3-D.

Mike Silva wrote:
> ... I'd like him to be able to do simple graphics fairly early, ...
VPython has primitives for cylinder, arrow (actually kind of clunky),
cone, sphere, and box.  In addition, it provides curve and convex
to build up paths and convex polyhedra from point lists.  Labels are
similarly easy, but interacting diectly with your shapes is a bit more
challenging.

I am nothing more than an enthusiastic user of VPython (no affiliation,
....)

-Scott David Daniels
Scott.Daniels at Acm.Org





More information about the Python-list mailing list