[vtkusers] vtk, wx, MacOSX

Sander Niemeijer niemeijer at science-and-technology.nl
Fri Feb 11 09:10:51 EST 2005


The last time I checked (which was indeed with wxPython 2.5.3 and VTK 
4.4) wxVTK was not working for Carbon.
As far as I know, nobody ever got it to work (it should be doable with 
the appropriate fixes to wxPython/VTK/wxVTK though).

The main problem is that the wxWindow.GetHandle() function in wxPython 
does not return a proper handle yet and the 
wxVTKRenderWindowInteractor.py (which is what I was using instead of 
wxVTKRenderWindow.py) uses a vtkRenderWindow.WindowRemap() that is not 
supported on Carbon. For our project (VISAN: 
http://www.science-and-technology.nl/beat) I already moved to a C++ 
wxVTK class with my own Python wrapping so I could, among other things, 
get around the WindowRemap issue. However, I still haven't been able to 
get the Carbon build working.

And while I am at it, I'll share with you the experiences I had with 
the other platforms:

The Gtk-1.2 build in combination with my own Python wxVTK class still 
gives me problems on Mac OS X and Linux if I leave threading enabled in 
Python/wxWidgets. Unless I disable threads, when a 
vtkPythonCommand::Execute callback is called on one my own Python 
objects I receive a SEGFAULT (we are currently using Python 2.3.4 by 
the way):
   PyFrame_New (tstate=0x0, code=0x43997a20, globals=0x4187c3e4, 
locals=0x0)
       at Objects/frameobject.c:540
       540             PyFrameObject *back = tstate->frame;
Somehow the tstate (current Python thread state) is NULL, which should 
never be possible. I don't know whether this is a problem in wxPython, 
Python, or VTK, but if anyone can shed some light on this I would be 
happy to hear about it.

I have also tried using GTK-2.0, but on both Linux and Mac OS X it 
gives me extreme cases of flickering with 2D plots and what looks like 
incorrect z-ordering for 3D visualizations. I haven't been able to 
figure out what was causing this.

The Windows build is also still not perfect: VTK will sometimes give me 
a 'wglMakeCurrent failed in Clean()' error when I close a window (only 
happens when multiple wxVTK windows are open and occurs with both our 
own C++ wxVTK class as well as the wxVTKRenderWindowInteractor.py 
class). The program will however happily continue, so this is not a 
real show-stopper for us.

Even considering all these problems, in the end we _did_ manage to 
create an application that uses a combination of wxPython and VTK (with 
VTK windows embedded in a wxWidgets window!) and is able to run on 
Linux, Mac OS X (using X11), and Windows. As far as I know, we are the 
only ones that ever got this to work. If there are other parties that 
also managed this, I would be extremely interested to hear about their 
experiences.

Best regards,
Sander Niemeijer

On vrijdag, feb 11, 2005, at 12:21 Europe/Amsterdam, Torsten Sadowski 
wrote:

> It's the latest wxPython-unicode 2.5.3 which is as far as I know Carbon
> and VTK 4.4 compiled for Carbon. wxCocoa is still in its infancy.
> Everything is running under 10.3.8.




More information about the vtkusers mailing list