How to change a mayavi scene background color?

Question:

This is probably a very simple question but I couldn’t find the answer anywhere!
I have embedded a mayavi scene into PyQt5 and I want to change the background color. (which is available from change properties button of scene in GUI)

My code looks like this:

class Visualizer(HasTraits):
    scene = Instance(MlabSceneModel, ())
    view = View(Item('scene', height=400, show_label=False,
                     editor=SceneEditor(scene_class=MayaviScene)),
                     resizable=True)
    def __init__(self):
        super(Visualizer, self).__init__()
        self.x, self.y, self.z = ...
    @on_trait_change('scene.activated')
    def update_event(self):
        self.plot = self.scene.mlab.points3d(self.x, self.y, self.z, color=(0.5, 1, 1))

any help would be appreciated.

Asked By: Esmail Mahjoor

||

Answers:

finally found the answer:

self.scene.background = (1, 1, 1) # for white

Answered By: Esmail Mahjoor
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.