Error when setting colorbar in traits
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 316
- Avg merge
- 7h 44m
- Merged PRs (30d)
- 5
Description
Dear Mayavi developers,
I've run into (another :) ) error... This time when trying to display a colorbar within the traits example:
``` python
#!/usr/bin/env python
"""A simple example of how to use mayavi.mlab inside a traits UI dialog.
This example uses traitsUI (
`traitsUI `_ ) to create a
the simplest possible dialog: a single Mayavi scene in a window.
"""
# Authors: Prabhu Ramachandran
# Gael Varoquaux
# Copyright (c) 2007, Enthought, Inc.
# License: BSD Style.
# Standard imports.
from numpy import sqrt, sin, mgrid
# Enthought imports.
from traits.api import HasTraits, Instance
from traitsui.api import View, Item
from tvtk.pyface.scene_editor import SceneEditor
from mayavi.tools.mlab_scene_model import MlabSceneModel
from mayavi.core.ui.mayavi_scene import MayaviScene
######################################################################
class ActorViewer(HasTraits):
# The scene model.
scene = Instance(MlabSceneModel, ())
######################
# Using 'scene_class=MayaviScene' adds a Mayavi icon to the toolbar,
# to pop up a dialog editing the pipeline.
view = View(Item(name='scene',
editor=SceneEditor(scene_class=MayaviScene),
show_label=False,
resizable=True,
height=500,
width=500),
resizable=True
)
def __init__(self, **traits):
HasTraits.__init__(self, **traits)
self.generate_data()
def generate_data(self):
# Create some data
X, Y = mgrid[-2:2:100j, -2:2:100j]
R = 10*sqrt(X**2 + Y**2)
Z = sin(R)/R
self.scene.mlab.surf(X, Y, Z, colormap='gist_earth')
self.scene.mlab.colorbar()
if __name__ == '__main__':
a = ActorViewer()
a.configure_traits()
```
throws an error:
``` error
ERROR: In /Users/builder/pisi-64bit/tmp/VTK-5.6.0-3/work/VTK/Widgets/vtkAbstractWidget.cxx, line 119
vtkScalarBarWidget (0x1186380c0): The interactor must be set prior to enabling the widget
```
I'm not sure whether this is an mayavi issue or a VTK bug (or I'm missing something and this is done otherwise...).
Best regards,
Tscheik
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.