Description
The current pysurfer code to use traitsui involves strange hacks to make the GUI busy for a short time while X renders the mayavi window but also without causing the GUI to enter an event loop and block. This section of code is very difficult to understand and maintain. A much more natural solution would be to use multithreading and explicit management of locking constructs to ensure that all of the events happen at the correct time.
The problem with this code is mainly with traitsui, which is an interactive GUI but which pysurfer is trying to use as a noninteractive GUI. Traitsui doesn't expose an API to usefully allow for precise timing of the GUI to be controlled in a multithreaded environment. In order to get the correct behavior without generating potential race conditions (which I think is what is happening now, only it is a race condition that is extremely unlikely to ever lose the race), I don't think embedding mayavi in traitsui will work.
I don't know any visualization libraries other than mayavi but I have been working on some simple tests to operate on VTK windows can be managed and display at the correct times in GUI code that does not involve traitsui -- I have proof of concept tests that suggest this should work with wxpython and tk (but it did not work at all with pyqt). As wxpython is not included in anaconda by default (and nothing about the GUI layout in pysurfer is particularly complex), tk is probably the better choice.
I'm of the opinion that to fix the current problems with traitsui, pysurfer should move in this direction (and I anticipate doing the majority of the work). This won't per se help eliminate dependencies on python 2.7 more quickly, but it will provide something more stable and maintainable so that pysurfer might later move to multiple backends as has been discussed before.