If you're new to Python
A VPython tutorial
Pictures of 3D objects
Choose an object:
Work with objects:
Windows & Events:
What's new in Visual 5
VPython is the Python programming language plus a 3D graphics module called "Visual" originated by David Scherer in 2000. This documentation describes all of the Visual capabilities.
VPython documentation is included with the VPython installer and is accessible from the Help menu in the VIDLE program editor. Documentation for the new VPython 6 is included with VPython 6 installers.
For a quick introduction, see youtube.com/vpythonvideos
Descriptions of the options available in the left margin:
Be sure to explore the many example programs that are installed with Visual.
To invoke the Visual module, place the following statement at the start of the file:
from visual import *
If you are using Python 2.7 or earlier, to make sure that 3/4 is treated as 0.75 rather than zero, start your program with the following statements (there are two underlines before future and two underlines after future):
from __future__ import division
This is not necessary with Python 3.0 or later, but it doesn't hurt, and including the division statement ensures that your program will handle division the same way on all versions of Python.
For experienced programmers
As a convenience to novice programmers to provide everything that is needed to get started, the statement "from visual import *" imports all of the Visual features and executes "from math import *" and "from numpy import *". It also arranges that for routines common to both math and numpy such as sqrt, the much faster math routine is used when possible (when the argument is a scalar rather than an array).
If you want to import the visual objects selectively, import them from the vis module. Two simple examples:
from vis import (box, color, materials)
There are clean modules vis.controls, vis.filedialog, and vis.graph equivalent to the modules visual.controls, visual.filedialog, and visual.graph. The latter versions execute "from visual import *" and are retained because some programs expect that behavior when importing one of these modules.
The documentation is written assuming that "from visual import *" is used.
VPython documentation was produced by Ruth Chabay, David Scherer, and Bruce Sherwood.