VPython 6 is based on the cross-platform library wxPython (wxpython.org), which allows Python programs to create windows and handle events on Windows, Macintosh, and Linux. The major changes from VPython 5 made possible by wxPython are the elimination of nearly all platform--dependent C++ code, the elimination of complex multithreading in the C++ code, and the ability for Macintosh versions to use 64-bit Python based on the Cocoa framework (VPython 5 on the Mac was based on the Carbon framework, which is no longer supported by Apple).
Almost all VPython 5 programs will run on VPython 6 with no change. However, animation loops must have a rate or sleep statement (not time.sleep) to permit the screen to be updated, and you must import visual or vis before importing graph or controls or filedialog, which most users have always done anyway.
New features in VPython 6
If is now possible to add controls such as buttons and sliders to a window that contains a VPython 3D scene, and these controls ("widgets") have the look and feel of the platform the program is running on (Windows, Mac, Linux). The usual zoom and rotate mouse options are available in the 3D portion of the window. Here is a snapshot of the example program widgets.py:
The functions for reading and writing files now offer platform-standard file dialog boxes.
At times you may need to know how large is the display region inside a window: window.dwidth and window.dheight are the extra width and height of windows compared to the display region. For example, if scene.width and scene.height are 500, the actual display region within the window has width = scene.width - window.dwidth and height = scene.height - window.dheight. If a menubar is added, that takes up an additional amount of vertical space given by window.menuheight.
Choose a topic:
VPython was initially created by David Scherer in the spring of 2000. Assisting him were David Andersen, Ruth Chabay, Ari Heitner, Ian Peters, and Bruce Sherwood.
Starting in 2002, Jonathan Brandmeyer made several major contributions to VPython 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.
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 and initiated work on stereo display, which was completed by John Zelle and Bruce Sherwood. Shaun Press implemented the pyramid and ellipsoid objects. Michael Temkine fixed some bugs and implemented keyboard handling for Windows.
VPython 5 was created by David Scherer and Bruce Sherwood in 2008. Jonathan Brandmeyer provided support in VPython 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 led to API changes which were incompatible with the VPython 4beta release, so there was no version 4.
Kadir Haldenbilen and Bruce Sherwood collaborated to create the 3D text object and the extrusion object for VPython 5.
The development of VPython 6, based on wxPython, was initiated by Bruce Sherwood in June 2012. Major contributions to the first release were made by Steve Spicklemire.
Here is a log of changes to VPython since the initial release of VPython 5 in December 2008, continuing with VPython 6, first released in February 2013.
2015-01-12: VPython 6.11 corrects an error in setting the axis of an object, in which sometimes the orientation of the object would flip 180 degrees, most noticeably when setting the axis of a frame.
2013-03-02: VPython 6.04 released to fix bugs and improve documentation.
2013-02-19: VPython 6.03 released by Bruce Sherwood and Steve Spicklemire. This version is based on the wxPython cross-platform GUI library, which has made possible the elimination of almost all platform-dependent code, and of the threading structure of VPython 5. Moreover, wxPython makes it possible for a window to contain a VPython 3D animation along with standard widgets such as buttons and sliders. VPython 5 on the Macintosh was based on the Carbon framework, which is no longer supported, whereas VPython 6 uses the supported Cocoa framework (through wxPython). VPython 6 includes improved mechanisms for handling mouse and keyboard events.
2012-04-23: Visual 5.74 fixes a bug in the display of ellipsoids
2012-04-15: Visual 5.73 with minor bug fixes (controls module, text object).
2012-04-01: Aaron Mavrinac moved the VPython source files from the increasingly obsolete CVS-format repository at sourceforge.net to an up-to-date git repository at github.com.
2011-12-10: Rebuilt Visual 5.72 source package for Linux to replace a Linux routine that is broken on recent releases of Ubuntu and Debian (and probably Fedora). This fixes the crashes of Visual on Linux that happened with the simplest programs.
2011-10-24 Visual 5.72 rebuilt to include a patch by Jason Morgan to fix a bug in packaging materials when using py2exe.
2011-10-19 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.
2011-05-06 VPython 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 VPython 5.70: Adds an easy to use way to leave a trail behind a moving object..
2011-03-23 VPython 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 VPython 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 VPython 5.51: Fix memory leak on Windows and Mac. Correct errors in assigning color and material to a text object.
2011-02-20 VPython 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 VPython 5.41 for Windows, to fix bugs in active and passive stereo.
2010-11-22 VPython 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 VPython 5.32 for Python 2.6 included numpy 1.3, whereas scipy now requires numpy 1.4.
2010-11-03 VPython 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 VPython 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 VPython 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 VPython 5.32 for Python 3.1, currently only for Windows.
2010-09-04 VPython 5.32 for Python 2.7 rebuilt for Intel Mac to use production version of numpy 1.5.0..
2010-08-31 VPython 5.32 for Python 2.7 rebuilt for Windows to use production version of numpy 1.5.0.
2010-08-16 VPython 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 VPython 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 VPython 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 VPython 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 VPython 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 VPython 5.22 not work on OSX 10.5. VPython 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, VPython 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 VPython 5.22 installer was released based on these libraries.
2010-01-26 VPython 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 VPython 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 VPython that worked with Python 2.6.4. VPython 5.14 is otherwise identical to VPython 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 VPython.
2009-10-13 VPython 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 VPython 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 VPython 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. VPython 5.11 fixes a minor bug in the handling of arrow attributes fixedwidth, shaftwidth, headwidth, and headlength to make behavior consistent with VPython 3. The documentation on these arrow attributes has been made clearer.
2009-05-15 VPython 5.1 for Python 2.6 released for Windows, Mac, and Linux. David Scherer provided crucial help for getting VPython to work on Python 2.6. VPython 5.1 includes formerly missing features of VPython 3, including right-button and middle-button mouse event handling. VPython 5 provides the basic mouse event functionality that was present in VPython 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 VPython 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 VPython 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 VPython 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 VPython 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 VPython 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 VPython-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.