Tuesday, September 27, 2011

Visual Python


I've been working with my son to develop 3D objects with VPython.  It's super cool and really rewarding.

This is the entire program for the green cylinder above:

from visual import *
rod = cylinder(radius= 1)
rod.green = .9
rod.red = 0
rod.blue = 0
It will also work with just this:
from visual import *

cylinder()


Awesome set of videos on learning to use visual python.

The only tricky part was that the visual library only worked with 32 bit Python.  Since I'm on Mac OS X, Snow Leopard, I had a 64 bit version of Python 2.7 installed.  I'm using a 32 bit version of Python 3.1 on the Mac in order to run visual.

You can find out what the architecture is with this:

>>> import platform

>>> platform.architecture()

('32bit', '')

>>> 


No comments:

Post a Comment