3D/4D graphics with Python and wxPython?

What you are looking for is called voxel visualization, voxel grid or such. I would seriously consider MayaVi (never used it, but I keep eye on it), it seems to have something very close here.

Paraview, built atop VTK just like MayaVi, might be a good option, too.

I think going straight to VTK for visualization is difficult, it is too low-level and will probably make you just frustrated. That said, you will want to save your data in as VTK datasets for opening in MayaVi/Paraview; it is not difficult, you just have to pick the right structure (vtkGrid, vtkUnstructedGrid, ...).


In my case, I chose to use directly the VTK bindings for Python. To be honest I found it simpler to get going with VTK than Mayavi, partly because the documentation is better (many many examples!). It felt like Mayavi was adding another layer of complexity on my way to get the job done. But tom10 is right. After you've started, using Mayavi may be easier.

Apart from that, Mayavi offers a library called TVTK which is a more pythonic version of the VTK bindings but in the end I chose plain VTK in order to minimize the number of dependencies. But you should check it out. Perhaps it will be just what you are searching for.

At the beginning I found very helpful this tutorial. It is not about Python, it is about tcl, but translating the examples is trivial and it helps you understand the way vtk works.

Also, in order to get you started, you can check the examples at the VTK Wiki. If they are not enough, you can always check the C++ examples and translate them to Python. The translation is not difficult as the names of methods and properties are the same. If you do, you are encouraged to add the examples at the wiki. There are even more examples in the source.

While you are learning VTK, you will (re)discover that Ipython is awesome! Having the whole VTK namespace at your fingertips helps enormously.

In case you need more specific help, the vtk-users mailing list is quite active. Lastly there are books about VTK, and some of them are free!They are not about Python though.

I haven't tried wxPython and VTK together, but that is because I prefer PyQt4 over wxPython. AFAIK there are no problems with the integration of VTK with either library. In any case, before spending time writing a GUI, check out thoroughly ParaView. It probably already does what you want, and if it doesn't, it is python scriptable too! (I've never checked it though).