[Edu-sig] Re: Teaching graphics with Python

Kirby Urner urnerk at qwest.net
Mon Aug 2 05:07:57 CEST 2004


> But getting it down to its essentials, the following runs, and provides a
> sphere primitive that insists on being blue.

Just upgraded to the latest VPython and tested your code (in Windows so far,
will move to Linux box next).  Works great.

Wondering where you're getting this info re atexit, for example, given
there's no documentation.  From digging in the source code you say?

> import cvisual

Had to change the above to:

import visual.cvisual as cvisual  # (just a path issue)

> import time
> import atexit
> 
> def __waitclose():
>     while not cvisual.allclosed(): time.sleep(0.05)
> atexit.register(__waitclose)
> 
> scene = cvisual.display()
> 
> class sphere (cvisual.sphere):
>     def __init__( self,*args,**keywords):
>         cvisual.sphere.__init__(self)
>         self.color=(0,0,1)

	    self.color=(160/255.,32/255.,240/255.)  # Purple!

>         self.complete_init( self, self,
>              1, scene, None)
> 

  scene.background = (1,1,1)  # white background anyone?
> s=sphere()

It's great to be able to finally do this VPython stuff interactively in the
native IDLE without problems (at least for the most part).

The Download page is more explicit now about what the default install will
do, e.g. overwrite any existing Numeric with version 23.0, plus mentions how
to get back to where Python default boots to a shell, not to the editor (my
preference, easily restored).

Kirby





More information about the Edu-sig mailing list