def test_test_backend(self): """Test if setting the backend to 'test' works.""" mlab.options.backend = 'test' mlab.test_contour3d() mlab.clf() mlab.pipeline.open(get_example_data('cube.vti')) mlab.clf()
def move_cam(outpath): """ Example to record a stream of images moving the camera around (using offscreen rendering) Usage: move_cam(out_path) Input: outpath - (String) output path to save images Output: -NONE- but stream of images is saved in outpath """ import os.path import tf_format from enthought.mayavi import mlab mlab.options.offscreen = True mlab.test_contour3d() # Example motion: rotate clockwise around an object step = 15 # degrees of change between views for i, angle in enumerate(range(0, 360, step)): view = mlab.view(azimuth=angle) imgname = os.path.join(outpath, 'example' + str(i) + '.png') mlab.savefig(imgname)
def example(): """ Example to run offscreen rendering with mayavi. If you see an 'int64' error, you will need to patch 'figure.py' to '... = int(magnification)'. This example saves a file called 'example.png' in the current folder, with some shapes. Usage: example() """ from enthought.mayavi import mlab mlab.options.offscreen = True mlab.test_contour3d() mlab.savefig('example.png')
def f(): mlab.options.backend = 'envisage' mlab.test_contour3d() GUI.invoke_after(3000, close)