Take the 2-minute tour ×

I have the following question. I have compiled the latest VTK under Mac Os X 10.6, and I am using Python bindings. The python distribution I use is the Enthought Python Distribution (EPD). Everything works quite well, however there is a difference in behaviour of the same program on Mac and on Linux with respect to keyboard event. It seems, that I miss some very important point. The part of the code is as follows

    vtkrenderer = vtk.vtkRenderer()
    vtkrenderWindow = vtk.vtkRenderWindow()
    vtkrenderWindow.SetSize(800, 600)
    vtkrenderWindowInteractor = vtk.vtkRenderWindowInteractor()
    vtkrenderWindowInteractor.GetRenderWindow().AddObserver('CharEvent', self.show_update)

The function self.show_update has the following form:

def show_update(self, renderer, event):
    if renderer.GetKeyCode() == ' ':
        self.update(renderer, event)
        print 'ready'
        #Do computations here

However, the spacebar is working only in the terminal, where I launch the program (using python test_particles.py but is completely ignored in the Cocoa window.

In Linux everything works as expected (keyboards are working fine).

Any help is appreciated.

share|improve this question
add comment


Your Answer



Browse other questions tagged or ask your own question.