From: Bruce S. <bas...@nc...> - 2010-09-15 16:59:42
|
A colleague points out that visual.basic (Visual Basic) maybe isn't the most intelligent nomenclature.... So if this idea has merit, there is at least the question of what the file should really be named. Bruce Sherwood On Wed, Sep 15, 2010 at 10:24 AM, Bruce Sherwood <bas...@nc...> wrote: > Maybe the desire for a cleaner import of visual isn't a big deal. I > put the following code in site-packages/visual/basic.py: > > from . cvisual import (vector, mag, mag2, norm, cross, rotate, > comp, proj, diff_angle, rate, waitclose) > from visual.primitives import (arrow, cylinder, cone, sphere, box, ring, label, > frame, pyramid, ellipsoid, curve, > faces, convex, helix, > points, text, distant_light, local_light) > from visual.ui import display > from . import crayola as color > from . import materials > from . import site_settings > import atexit as _atexit > _atexit.register(waitclose) > scene = display() > > Next I successfully ran some little programs such as this one: > > import visual.basic as vb > vb.box(pos=(1.5,0,0), color=vb.color.orange, material=vb.materials.wood) > C = vb.curve(pos=[(0,0,0),(1,0,0),(1,1,0),(0,1,0)], color=vb.color.cyan) > print(C.pos) > vb.scene.mouse.getclick() > scene2 = vb.display(x=400) > vb.sphere() > > I haven't done extensive testing, and I'm interested in suggestions > for improvement. The key point of course is that this doesn't import > all of math and numpy, but leaves "from visual import *" still > available. > > Bruce Sherwood > |