Home

Documentation

Download:
   Windows
   Macintosh
   Linux

New in VPython 6

Recent developments

VPython wiki

User forum

Contributed programs

For developers

Python web site

 

Linux Downloads

Downloads provided by sourceforge.net
crystal

Linux downloads for VPython 6, using Wine

Your Linux distribution may already have a VPython package, which on Ubuntu is named python-visual. However, it is likely to be very far out of date. It is recommended to run the latest Windows version of VPython under Wine (www.winehq.org). Wine lets you run Windows programs on Linux. It is not an emulator; VPython under Wine runs at normal speed. Your Linux distribution probably has a Wine package. You will need the following Windows files:

For 32-bit Linux:
   Download the 32-bit Python-2.7.5 from python.org
   Download the Windows 32-bit library file python27.dll
   Download VPython-Win-32-Py2.7-6.05
      This version of VPython requires Python 2.7.x from python.org.

For 64-bit Linux:
   Download the 64-bit Python-2.7.5 from python.org
   Download the Windows 64-bit library file python27.dll
   Download VPython-Win-64-Py2.7-6.05
      This version of VPython requires Python 2.7.x from python.org.

Installing VPython 6 under Wine

Install Wine, which is probably available in your Linux distribution packages.

Run the Wine configure program. Here you will have the opportunity to choose the look and feel of execution (e.g. XP, Windows 7, etc.).

Assume that in your Downloads folder the downloaded installers are named Python2.7.msi and VPython.exe. In a terminal, execute the following (adjust the file name Python2.7.msi appropriately):

cd ~/Downloads

wine msiexec /i Python2.7.msi /qn TARGETDIR=C:\Python27 ALLUSERS=1

Copy python27.dll into ~/.wine/drive_c/windows/system32. At least on some Linux distributions you can press Ctrl-H to hide or unhide hidden folders such as .wine when viewing files in the file browser.

Run the Wine configure program again. In Applications, if it is not already there, click Add application, choose Python27, and doubleclick python.exe. Then in Libraries, in "New override for library", enter python27.dll, and click Add. Select python27.dll in "Existing_overrides" and click Edit. Click "Native (Windows)". Click OK.

At this point you should have a working Windows version of Python 2.7, which you can test by executing this in a terminal: wine ~/.wine/drive_c/Python27/python

Next, in the ~/Downloads folder, right-click VPython.exe (or whatever the downloaded VPython installer is called) and choose "Open With Wine Windows Program Loader". This will start the VPython installer. You might get error messages asking for help in finding Python 2.7, which is located at ~/.wine/drive_c/Python27. This will put the "VIDLE for VPython" icon on your Linux desktop. Double-click this icon, which should start up VIDLE. On the File menu choose Open and pick one of the VPython example programs.

There is (at least) one bug: In VIDLE, if you choose Help > VPython, you get an error. The VPython documentation can be accessed by doubleclicking ~/.wine/drive_c/Python27/Lib/site-packages/visual/docs/index.html. You might wish to bookmark this location in your browser.

Building from source for VPython 6

Building from source is difficult because a large number of dependencies must be satisfied.
Here is the source code: vpython-wx-src.6.05b.zip
Be sure to study the file INSTALL.txt for instructions on building VPython.
If you have an existing VPython, you will need to delete the old folders visual, vis, and vidle from site-packages or dist-packages.
There is an older VPython 5.74 for Python 3.2.

How to run VPython

  • Start the program editor VIDLE. Do not use the Python IDLE editor with VPython 6.

  • On the File menu choose Open and choose an example program -- for example, bounce2.py.

  • Press F5 to run (or use the Run menu).

  • Every time you run, your files are automatically saved (if you have changed them).

  • Right button drag to rotate the "camera" to view a 3D scene.
       On a one-button mouse, right is Command + mouse.
    Middle button to drag up or down to zoom in or out.
       On a two-button mouse, middle is left + right.
       On a one-button mouse, middle is Option + mouse.

Compatibility with the future and the past

We encourage you to place the following statement at the start of your programs, in order that your program will run not only on Python 2.7 today, but also will run in the future on the newer Python 3.x series. Note the double underscore before "future" and the double underscore after "future".

from __future__ import print_function, division

For Python 2.7, this statement invokes the new Python 3.x print format, namely "print(x)" instead of the old "print x", and the new division scheme, namely that 3/4 is 0.75, not zero as in the past. This statement is ignored by Python 3.x.

Changes from VPython 5: With VPython 6 you must include a rate statement in animation loops, and you must import visual or vis before importing graph or controls or filedialog.

Conditions of use

The Polygon module distributed with VPython may not be used except with VPython. Here's why:

In support of the text and extrusion objects, the Windows installer includes some 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/".

What is installed

The VPython installer installs the vis, visual, and visual_common modules, the numpy, FontTools, Polygon, and ttfquery modules needed by VPython, and VIDLE, an improved version of the IDLE program editor, into /usr/local/lib/python2.7/dist-packages.

Materials such as wood

Materials such as wood will work with graphics cards that support Pixel Shader 3.0 ("PS 3.0"). See
http://en.wikipedia.org/wiki/Pixel_shader#Hardware. Some materials may work with graphics cards that support PS 2.0, but other materials may need to be manually disabled: In the folder C:\PythonNN\Lib\site-packages\vis, edit the file site-settings.py to disable shaders. If the graphics hardware does not support pixel shaders, the material property is ignored. If you think you should be able to use materials but have trouble with their display or performance, we highly recommend upgrading your video card drivers to the latest version.

Older versions

Important information concerning VPython 5 on Ubuntu, from John Zelle: "I think we have tracked down the problem with VPython seg faulting on 64 bit Ubuntu with NVIDIA drivers. It appears that some packages install a minor version upgrade of some glx libraries that cause the breakage. The following command restores a working VPython for us:

sudo apt-get install libgl1-mesa-glx=8.0.2-0ubuntu3 libglapi-mesa=8.0.2-0ubuntu3

This reverts from the 8.0.3 version of these packages down to the 8.0.2 that was the original install and that the stock NVIDIA drivers are apparently built against. So we now have VPython working on 64-bit Ubuntu using both the stock NVIDIA drivers and python-visual that come with Ubuntu."

Here is the latest source package for use with Python:

Download and unpack visual-5.74_release.tar.bz2

Study the instructions in INSTALL.txt, which are necessarily quite complicated.
If you are new to Linux, it is strongly advised to use the Linux package manager instead.
Note the special instructions about site-packages on Ubuntu 9.04 and later.

There is a bug in the standard Boost libraries on Ubuntu 9.10, and to build VPython
you must first install Boost 1.38 libraries from https://launchpad.net/~ajmitch/+archive/ppa.
Be sure to read and follow ALL of the instructions; click on everything in sight on that web page.

If you wish to try building Visual for Python 3, you will need Python 3 dist-util versions of the font modules FontTools, Polygon, and ttfquery.

After installing VPython, start IDLE (you may have to install it). Assuming your Python is /usr/bin/python,
      1) You can execute python /usr/lib/python2.6/idlelib/idle.pyw.
      2) You may be able simply to execute "idle", depending on your flavor of Linux.
      3) Open an example program in /usr/lib/python2.6/site-packages/visual/examples,
          for example, bounce2.py.
Press F5 to run (or use the Run menu).
Every time you run, your files are automatically saved (if you have changed them).
Documentation is found at /usr/lib/python2.6/site-packages/visual/docs/index.html

RECOMMENDED: An alternative version of IDLE that fixes some problems with the standard IDLE

Older versions of Visual (and/or for older versions of Python)