Mayavi colorbar in TraitsUI creating an empty window

I am trying to create a graphical interface in TraitsUI that includes two Mayavi digits. I performed these numbers according to a few engine examples in the Mayavi documentation.

However, when I add a color bar to one of the shapes and run the GUI script, it sometimes opens a blank Mayavi script editor window in addition to the desired TraitsUI window. This empty window does not always appear, never in the first run after restarting the python kernel, and sometimes only after running the script several times in a row and closing the windows that appear every time.

Executing the code below leads to the same behavior, and deleting the mlab.colorbar(s) stops the problem. How can I get a color panel without opening blank windows? There seems to be no obvious way to assign a color panel to a specific drawing, as for a surface area. I am running Python 3.5 on Windows 7 (but getting the same problems on Ubuntu).

 from traits.api import HasTraits, Instance, on_trait_change from traitsui.api import View, Item import numpy as np from mayavi.core.api import Engine from mayavi.core.ui.api import SceneEditor, MlabSceneModel from mayavi import mlab #Generate a test surface to display def test_surf(): x, y = np.mgrid[-7.:7.05:0.1, -5.:5.05:0.05] z = np.sin(x + y) + np.sin(2 * x - y) + np.cos(3 * x + 4 * y) return x, y, z class MyApp(HasTraits): #Create a mayavi scene with a specified engine engine = Instance(Engine, ()) scene = Instance(MlabSceneModel) def _scene_default(self): self.engine.start() return MlabSceneModel(engine=self.engine) #Plot the surface when the scene is activated @on_trait_change('scene.activated') def populate_scene(self): s = mlab.surf(*test_surf(), figure=self.scene.mayavi_scene) mlab.colorbar(s) view = View(Item('scene', editor=SceneEditor())) if __name__ == '__main__': MyApp().configure_traits() 
+7
python traitsui mayavi
source share

No one has answered this question yet.

See related questions:

3790
How can I safely create a subdirectory?
2453
How to install pip on Windows?
1065
How to create multi-line comments in Python?
one
Change mlab quiver3d & surf data sources without clearing shape in feature scripts
one
How to animate imshow mayavi
one
Enthought Mayavi Animation Blank Display
one
Search for the current location of editors in traitsui
0
python TraitsUI variable number of elements in view
0
How to use mlab iso_surface module in Mayavi application
0
current traitsui editor size

All Articles