How to remove Mayavi toolbar in python using code

后端 未结 1 1235
北荒
北荒 2021-01-16 00:48

I have several Mayavi plots that I am combining in a single window (along the lines of the documentation), and it would be much better if I could get rid of the toolbars in

1条回答
  •  北海茫月
    2021-01-16 01:16

    You can use Handler to modify UI, the following code works with ETS_TOOLKIT=qt4. Add the DisableToolbarHandler class to the code multiple_mlab_scene_models.py, and show the UI by m.edit_traits(handler=DisableToolbarHandler()).

    class DisableToolbarHandler(Handler):
        def position(self, info):
            for name in ["scene1", "scene2"]:
                editor = info.ui.get_editors(name)[0]
                editor._scene._tool_bar.setVisible(False)
    
    m = MyDialog()
    m.edit_traits(handler=DisableToolbarHandler())
    

    The windows shows as:

    enter image description here

    0 讨论(0)
提交回复
热议问题