>>>>> "Hans" == Hans Fangohr <[EMAIL PROTECTED]> writes:

    Hans> All this is working, but(!) while our simulation carries on
    Hans> (step (iv)), we can't interact with the Mayavi window. In
    Hans> particular, we can't zoom in and out and rotate the scene.

Attached is a simple example that does just this using mayavi's
do_callback along with the thread module.  The code is illustrative
but you might want to use the 'threading' module instead for cleaner
code.

cheers,
prabhu

import Tkinter
import thread
import mayavi

def big_computation():
    i = 0
    while i < 10000000:
        i += 1
    return

def show(v):
    v.renwin.camera.Azimuth(10)
    v.Render()
    
def work(v):
    for i in range(10):
        print "computing...",
        big_computation()
        print "done."
        v.do_callback(show, v)

def main():
    r = Tkinter.Tk()
    r.withdraw()

    v = mayavi.mayavi()
    v.open_vtk('heart.vtk', 0)
    v.load_module('SurfaceMap', 0)
    
    thread.start_new_thread(work, (v,))
    r.mainloop()

if __name__ == '__main__':
    main()
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users

Reply via email to