>>>>> "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.
Hans> This is what I would like to be able to do.
Hans> Any suggestions?
A few possibilities:
1. Using mayavi's start_animation method to call things is a good
idea. An example is attached below.
2. Use a thread to run the compute intensive code. The only problem
is you will need to make sure the mayavi/tkinter calls are made
only from their own thread and not from the compute intensive
code. You can do this using the MayaViTkGUI's do_callback method.
3. You can generate the data separately. Then from a separate Python
program you can poll the file as done in the example below to
display things. Option 2 is nicer.
I wish I had a quick example for option 2 but I don't have it handy
right now.
Here is the example yanked from a message I sent in Feb 2003.
########## Code ##########
import os
from Tkinter import *
import mayavi
r = Tk()
r.withdraw()
v = mayavi.Main.MayaViTkGUI(r)
# open the data.
data = v.open_vtk('data.vtk', 0)
# create a visualization
f = v.load_filter('PolyDataNormals', 0)
f.fil.SetFeatureAngle(45.0)
polydata = v.load_module('PolyData', 0)
# now stat the data file and poll it to see if it changes.
last_stat = os.stat('data.vtk')
def anim():
global last_stat
s = os.stat('data.vtk')
if s[-2] == last_stat[-2]:
return
last_stat = s
data.reader.Modified()
data.reader.Update()
data.update_references()
v.Render()
v.start_animation(1500, anim)
r.mainloop()
########## Code ##########
Let me see if I can get an example of threaded code if I get the time
tonight.
cheers,
prabhu
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