mayavi doesnot support wxphonix, so I wrote a simple one named myvi, I think it will be help to you.
on windows is ok, but on mack and linux cannot build gl3.3 context. I think it is wx’s bug, (my vi can run ok with qt on mac and linux) anyone can help?
···
来自我的新浪邮箱android客户端
-------- 原始邮件 --------
发件人:Chris Barker
时 间:2017年11月21日 06:29(星期二)
收件人:wxpython-users
主题:Re: [wxPython-users] visualization - bar magnet
I think you’re going to want mayavi for this
wx itself provides nothing for 3D – so you would have a lot of code to write
you can embed an OpenGL Window in wx, but then you have to write all the OpenGL code…
BTW, if you can stick with 2D, then wx.lib.floatcanvas would help a lot.
-CHB
On Mon, Nov 20, 2017 at 9:27 AM, Simonious Rex simonious@gmail.com wrote:
I’ve got this great example (included below) and I want to implement this sort of visualization as a function.
I’d love to be able to step forward and backward, as well as free run, but I don’t need to start with that functionality.
I would like the visual elements to be shaped like bar magnet arrows and I’d like to be able to control their (x,y,z)position, color, orientation and (x,y,z)size.
My intention is to maintain an array of data, perform some calculations between the elements and generate a second array, this array will then call the above function to create a visualization, then the second set of data will become the first set of data and the process will repeat.
For a first example I’m hoping to program a 3D version of life, from there I will be adding some additional behaviors which will include the color and orientation.
Example code follows:
#Prabhu Ramachandran
import numpy as np
from mayavi import mlab
import time
def step(x, y, z):
data = np.random.random(x.shape)
cond = data > 0.75
return x[cond], y[cond], z[cond], data[cond]
#x, y, z = np.mgrid[0:10:50j, 0:10:50j, 0:4:20j]
x, y, z = np.mgrid[0:3:20j, 0:3:20j, 0:3:20j]
xn, yn, zn, sn = step(x, y, z)
Will give you spheres, use mode=‘cube’ for cubes.
pts = mlab.points3d(xn, yn, zn, sn, scale_mode=‘none’, scale_factor=0.1)
#pts = mlab.points3d(xn, yn, zn, sn, mode=‘cube’, scale_mode=‘none’, scale_factor=0.1)
@mlab.animate
def anim():
while True:
xn, yn, zn, sn = step(x, y, z)
pts.mlab_source.reset(x=xn, y=yn, z=zn, scalars=sn)
Do this if the scene does not update: needed for slightly older versions of Mayavi.
pts.mlab_source.update()
time.sleep(0.01) # Slow things down a bit.
yield
anim()
–
You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
–
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
–
You received this message because you are subscribed to the Google Groups “wxPython-users” group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.