If you're new to Python
and VPython: Introduction

A VPython tutorial

Pictures of 3D objects

Choose an object:

Work with objects:

Windows & Events:

What's new in Visual 5

VPython web site
Visual license
Python web site
Math module (sqrt etc.)
Numpy module (arrays)

New Features in Visual 5
material etc

Recent improvements

The extrusion object introduced with Visual 5.50 enables the easy creation of complex extruded shapes. Aided by the shapes library, you make a 2D shape that can contain holes. Then, aided by the paths library, you choose a path along which your 2D shape is extruded.

The curve object can use the shapes library and paths library for constructing the set of points.

Visual 5.60 adds facilities to extract faces data from extrusion and text objects, the ability to make these objects single-sided for increased speed, and improved gear facilities in the shapes library, including rack gears.


Visual 5.61 adds mouse crosshairs to graphs, simplifies the use of controls (no need to call interact), fixes a long-standing inconsistency in the background of a label object's box, and fixes bugs in materials.bricks and in the checking for the presence of Polygon and font modules.

Visual 5.70 adds an easy way to leave a trail behind a moving object.

Visual 5.71 adds log-log and semilog plots to graphs, and the ability to offset the graph origin.

Visual 5.72 corrects a bug in graphs where plotting (0,.001) followed by (.001,.001) failed to autoscale correctly. Also added documentation explaining what objects are used to represent gdots, gcurves, ghbars, and gvbars.

Visual 5.73 corrects some bugs in the controls module and the text object.

Visual 5.74 corrects an error in the display of ellipsoids.

Choose a topic:


Changes from the old Visual 3

Known incompatibilities compared to the old Visual 3

A log of developments since the start of Visual 5


Visual 5 was created by David Scherer and Bruce Sherwood. Jonathan Brandmeyer provided support in Visual 4beta for opacity, local lighting, and textures, and made some important architectural changes, but had to stop work on the project before it was completed.  Further development has led to API changes which are incompatible with the Visual 4beta release, so this release is called version 5 instead of 4.

The late Arthur Siegel implemented dependence on the currently supported numpy library in place of Numeric, which is no longer supported. Hugh Fisher provided a big start on the native-mode Mac version. Michael Temkine fixed some bugs and implemented keyboard handling for Windows.

Previous to Visual 4beta, Jonathan Brandmeyer made several major contributions to Visual 3, including changing the connection between Python and C++ from CXX, which was no longer supported, to the Boost C++ libraries, and implementing auto-configurable installations for Linux.

Kadir Haldenbilen and Bruce Sherwood collaborated to create the 3D text object, and the extrusion object.

Changes from the old Visual 3

Here is a brief summary of what is new in Visual 5 compared to the old Visual 3:

Transparency (opacity).

Materials such as wood and plastic; also used to display images.

Local lights in addition to distant lights.

A 3D text object.

A points object.

Changing the visible attribute of a frame affects all objects in the frame, and there are functions for converting between frame and "world" coordinates.

When appending to a curve, you can specify how many points to retain.

You can specify a font for a label.

You can say color=color.gray(0.7) to mean color=(0.7,0.7,0.7).

There is a simple file dialog display for choosing files.

If you say scene.show_rendertime = True, in the lower left of the graphics window you will see the cycle time (time between renderings of the scene) and the render time (time taken to render the scene).

There are functions for faces to create normals, to make two-sided, and to affect smoothing.

In a graph, you can highlight the current plotting position.

Known incompatibilities compared to the old Visual 3

Here are known incompatibilities:

There are some unavoidable incompatibilities due to the fact that the currently supported numerical array package numpy differs from its predecessor Numeric. The only way to handle some of these incompatibilies is by using the Python "try/except" structure. For examples, see the example programs gas.py or stars.py.

You can still set scene.lights in the same way as in Visual 3, but you cannot read the information in scene.lights in the same way as before, because in Visual 5 scene.lights is a list of distant_light (and/or local_light) objects, not a list of vector directions. If you read and used information in scene.lights, you may need to use a Python "try/except" structure to make your program run on both Visual 3 and Visual 5. For example, suppose an old program wanted to have two lights, one 70% as bright as the first light in the scene.lights list, and the other a duplicate except coming from the back, to light both front and back of the scene. Here is code to do this:

    L0 = 0.7*norm(scene.lights[0])
    L1 = vector(L0.x, L0.y, -L0.z)
    scene.lights = [L0, L1]
    L0 = scene.lights[0]
    L0.color = 0.7*vector(L0.color)
    scene.lights = [L0]
    d = L0.direction
    L1 = distant_light(direction=(d.x,d.y,-d.z),

A log of developments since the start of Visual 5

Here is a log of changes to Visual since the initial release of Visual 5.0 in December of 2008. This and earlier history can be found at vpython.org in the "Recent developments" section.

2011-05-06 Visual 5.71: Adds log-log and semilog plots to graphs, and the ability to offset the graph origin. Thanks to a diagnosis by David Scherer, random dots around the text of label objects (Windows and Linus) are (nearly) eliminated. A bug that occasionally prevented a graph from displaying has been fixed.

2011-03-27 Visual 5.70: Adds an easy to use way to leave a trail behind a moving object..

2011-03-23 Visual 5.61: Adds mouse crosshairs to graphs, simplifies the use of controls (no need to call interact), fixes a long-standing inconsistency in the background of a label object's box, and fixes bugs in materials.bricks and in the checking for the presence of Polygon and font modules.

2011-03-13 Visual 5.60: Add facilities to extract faces data from extrusion and text objects, and to make extrusion and text objects single-sided for speed. Kadir Haldenbilen contributed improved gear facilities to the shapes library, including rack gears.

2011-03-01 Visual 5.51: Fix memory leak on Windows and Mac. Correct errors in assigning color and material to a text object.

2011-02-20 Visual 5.50 for all platforms introduces the powerful extrusion object developed by Kadir Haldenbilen and Bruce Sherwood. Included are shapes and paths libraries that simplify the creation of complex extrusions. Haldenbilen has also contributed new materials which can be viewed in the updated example program material_test.py. The curve object has been modified to be able to use the new shapes and paths libraries.

2010-12-02 Visual 5.41 for Windows, to fix bugs in active and passive stereo.

2010-11-22 Visual 5.4 package for Python 2.6 for Windows and Mac, which includes numpy 1.5.1. It was pointed out that there was no scipy module for Python 2.7 or Python 3.1, and the existing Visual 5.32 for Python 2.6 included numpy 1.3, whereas scipy now requires numpy 1.4.

2010-11-03 Visual 5.4 package for Python 2.5, 2.6, or 2.7 for Linux. This package can presumably also be used to build on Python 3.1, but this would require building Boost libraries for Python 3.1, for which there may not be Linux packages.

2010-10-27 Visual 5.4 for Python 2.7 and Python 3.1, for Windows and Mac.This release includes a new module, "vis", which permits selective import of Visual objects without the importing of math and numpy that is done for "from visual import *". See the main page of the full documentation for details. The font modules included in this VPython installer have been updated to work with Python 3.1, but tested only to the extent that they work with VPython. It is quite possible that additional work is needed to make them fully functional with Python 3.1. Ned Deily fixed a problem with IDLE (and VIDLE) on Macs; it was recently noticed that quitting on the Mac did not prompt you to save unsaved code.

2010-09-14 Beta test version of Visual 5.32 for Python 3.1, currently only for Windows.

2010-09-04 Visual 5.32 for Python 2.7 rebuilt for Intel Mac to use production version of numpy 1.5.0..

2010-08-31 Visual 5.32 for Python 2.7 rebuilt for Windows to use production version of numpy 1.5.0.

2010-08-16 Visual 5.32 is now available for Python 2.7 for Windows and Intel Macs using beta version of numpy 1.5.0.

2010-04-10 Visual 5.32 released for all platforms. Now the 3D text object handles multiline text containing newline characters ("\n"), and Kadir Haldenbilen made a 20% speedup in the creation of the text object.

2010-04-02 Visual 5.31 released for all platforms. Kadir Haldenbilen made further corrections to the ttfquery and FontTools modules, which fixed a variety of errors in rendering 3D text.

2010-03-30 Visual 5.3 released for all platforms. Thanks to great work by Kadir Haldenbilen, there is a new "text" object that from any True Type (.ttf) font produces extruded 3D text. This supercedes the very limited old visual.text machinery (which however is being left in place for upward compatibility). The Windows and Mac versions install some font-handling modules that include Polygon, for which the following conditions apply: "Polygon is being distributed subject to the following conditions: This distribution contains code from the GPC Library, and/or code resulting from the use of the GPC Library. This usage has been authorized by The University of Manchester, on the understanding that the GPC-related features are used only in the context of this distribution. It is not permitted to extract the GPC code from the distribution as the basis for commercial exploitation, unless a GPC Commercial Use Licence is obtained from The University of Manchester, contact: http://www.cs.man.ac.uk/~toby/gpc/". There are new faces functions make_normals() and make_twosided(), and you can now specify your own criterion for smooth(). The gcurve object for making graphs now has an option "dot=True" that highlights the currently plotted point on the curve. Some minor bugs were fixed in faces, points, and helix.

2010-02-17 Gary Pajer pointed out that numpy 1.4.0 had been withdrawn, so Visual 5.24 for Windows and for Mac were built to use numpy 1.3.0 instead.

2010-02-03 Mirko Bordignon fixed a bug in the Mac build procedure that made Visual 5.22 not work on OSX 10.5. Visual 5.23 for the Mac should work on OSX 10.4 or later.

2010-01-28 Thanks to work by Mirko Bordignon on threading problems, Visual 5.21 released for the Mac, which may address problems seen on the Mac with VPython refusing to start. It was discovered that 5.21 didn't work on OSX 10.5, so Mirko rebuilt the Boost libraries on OSX 10.5 and verified that VPython would then work on both 10.5 and 10.6, and a Visual 5.22 installer was released based on these libraries.

2010-01-26 Visual 5.2 released for Windows, Mac, and Linux includes new faces function "smooth()" which averages similar normals at shared vertices to make an object look smoother. See faces documentation.

2009-12-23 Visual 5.14 released for Windows for any version of Python 2.6. This fixes a problem that until the development of Boost 1.41 it was not possible to build an installer for Visual that worked with Python 2.6.4. Visual 5.14 is otherwise identical to Visual 5.13. Work is proceeding to deal with the same problem on Macintosh (work completed 2010-01-23, thanks to help from Mirko Bordignon). For Linux, simply use Boost 1.41 to build Visual.

2009-10-13 Visual 5.13 released for Windows (Python 2.6), Mac (Python 2.6, Intel, OSX 10.4 and above), and Linux. Bugs fixed on Linux concerned with making windows visible and invisible, and with reporting correct values of scene.x, scene.y, scene.width, and scene.height. Bugs fixed on all platforms: vector.mag now is ordinary number instead of numpy.ndarray; helix.color is (red,green,blue) instead of an array (the array of colors in the helical curve is helix.helix.color); corrected documentation error which erroneously claimed that that you couldn't specify a list of points for gcurve, gvbars, or ghbars; error in VIDLE corrected by Guilherme Polo -- sometimes initially scrolled so that the first line was not visible.

2009-08-21 Visual 5.12 released for Windows (Python 2.6), Mac (Python 2.6, Intel, OSX 10.4 and 10.5), and Linux. New: frame_to_world and world_to_frame functions for converting between frame and "world" coordinates, stimulated by a suggestion of Robert Xiao. Fixes: bug in frame manipulations (pointed out by Robert Xiao), bug in helix that didn't permit creating additional attributes when creating a helix. There are significant improvements to VIDLE thanks to Guilherme Polo, including the ability to edit and test without first saving a file, and the shell window coming forward when there is an error, to alert you. The VIDLE startup icon on the Mac (in /Applications/VPython) has been simplified and is probably more robust.

2009-06-19 Visual 5.11 released for Windows (Python 2. 5 and 2.6 ), Mac (Python 2.6, Intel and PowerPC, OSX 10.4 and 10.5), and Linux. Not yet released for Mac with Python 2.5. Visual 5.11 fixes a minor bug in the handling of arrow attributes fixedwidth, shaftwidth, headwidth, and headlength to make behavior consistent with Visual 3. The documentation on these arrow attributes has been made clearer.

2009-05-15 Visual 5.1 for Python 2.6 released for Windows, Mac, and Linux. David Scherer provided crucial help for getting Visual to work on Python 2.6. Visual 5.1 includes formerly missing features of Visual 3, including right-button and middle-button mouse event handling. Visual 5 provides the basic mouse event functionality that was present in Visual 3 for handling events from right and middle buttons when userspin or userzoom is disabled, out of concern for supporting old programs. However, it has become evident that there are limitations to this approach which could preclude some kinds of mouse handling that people might want to do in the future. For example, you might want to allow userspin with right drags yet also pick up right clicks. For that reason it is conceivable that future developments in this area might break existing programs, and therefore for maximum forward compatibility it is prudent to use only left-button interactions in new programs.

2009-03-27 Release of VIDLE, an alternative to IDLE which fixes some long-standing problems; David Scherer, assisted by Bruce Sherwood.

2009-01-20 Visual 5.03 for all platforms incorporates a fix to handling keyboard events proposed by CL Cheung after his careful analysis of a deadlock condition.

2009-01-17 Visual 5.02 for all platforms incorporates corrections made by CL Cheung: fixing a bug associated with changing the opacity of an object in a frame, and, on Windows, changing some details of mouse handling which affected docking/undocking operations in the wxpython context. Tests of the frame bug which failed on Windows did not fail on Mac or Ubuntu, but the fix has been incorporated anyway, as there really was a bug in the code.

2008-12-31 Visual 5.01 for Linux corrects an error in the size attribute of the points object. New documentation of size and shape attributes for graphing gdots. Package now includes threadpool files.

2008-12-30 Visual 5.01 for Windows and Mac corrects an error in the size attribute of the points object. New documentation of size and shape attributes for graphing gdots.

2008-12-8 Release of Visual 5.0 by David Scherer and Bruce Sherwood: opacity, local lights, materials such as wood. Includes for the first time a native-mode version for the Mac.

2008-06-20 John Armstrong contributed an easy-to-use installer for VPython 3.2.11 for Intel Macs running OS X 10.5 (Leopard).

2008-03-10 A major redesign for Visual-4 Beta is underway. The central goal of the new design is to create an architecture which is more robust, easier to maintain and to extend, and easier to install and to use. The principal architects are David Scherer and Bruce Sherwood. Steve Spicklemire and Ruth Chabay have also been involved in discussions. As a result, a number of changes to the current beta version are likely. Support for textures will change. Rather than creating a texture bitmap, a programmer will be able to specify a material (such as wood). Transparency will be supported. At this point it is unclear exactly what support there will be for bitmapped images; they may be supported only as "decals" which can be applied to flat surfaces. Lighting options may change; it is likely that spotlights will not be supported at first in this version. You can look forward to higher-quality rendering of scenes on computers with modern graphics cards. A Macintosh version which does not require X11 or Fink will be created. Both the Windows version and the Mac version will no longer depend on the large GTK libraries, which will however still be the foundation for Linux.