Question

I have a Mayavi scene widget with a toolbar and I want to add a button with the same behaviour that pressing CTRL+C, CTRL+A (Change between camera and actor interactor mode).

I think that simulating a key press event by cliking in the button is the simplest aproach to do that, so the question is ¿How to simulate a key press event in Traitsui (the Mayavi GUI toolkit)?

Does anybody know another way to perform the same action that CTRL+C, CTRL+A?

Thanks in advance!

Was it helpful?

Solution

There is no straightforward way to simulate a keypress event in a mayavi scene or that I am aware of in traitsui or enaml.

This is also an extremely non-traithonic way of getting the desired behavior. The right way to do it is to make calls to the tvtk interactor, asking it for the right style:

self.scene.interactor.interactor_style.set_current_style_to_trackball_camera()
self.scene.interactor.interactor_style.set_current_style_to_trackball_actor()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top