[vtkusers] Problem VTK4 + python 2.2

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Mon Jan 14 14:46:57 EST 2002


>>>>> "DG" == David Gobbi <dgobbi at irus.rri.ca> writes:

    DG> Okay, it's committed to
    DG> VTK/Wrapping/Python/wxVTKRenderWindow.py.  It requires the
    DG> wxGLCanvas in order to get rid of the flicker.

    DG> I also recommend wxGTK-2.2.x over the not-yet-stable
    DG> wxGTK-2.3.x, because at least I'm familiar with the problems
    DG> with 2.2.x whereas 2.3.x changes with each point release.

    DG> It works fine under Windows, but I haven't tried it with
    DG> Motif.

There were two lines that needed changing for me.

$ diff wxVTKRenderWindow.py /tmp/wxVTKRenderWindow.py 
197c197
<         self._RenderWindow.SetSize(size[0], size[1])
---
>         self._RenderWindow.SetSize(size.width, size.height)
237c237
<         width, height = event.GetSize()
---
>         width, height = event.GetSize().asTuple()

Once these were done it worked well.  I looked through your code and
it looks nice.  Its a good idea to use the GL Canvas.  I believe Dave
Reed found that using a GLCanvas in the GtkRenderWindow also helped a
lot.  One design question.  The way my wxVTKRenderWindow was written
was with a base and derived class.  This was done so that it would be
easier for a user to incorporate their custom interaction.  Any
reasons why you didnt do it this way?

There is one small bug that I found.  If you just fire up
wxVTKRenderWindow.py and then hit any key (before you move the mouse)
it will raise an exception.  This is because UpdateRenderer is not
called untill the mouse is pressed so there is no
self._CurrentRenderer.  One way to fix this is to call UpdateRenderer
on OnEnter.  What do you think?

The other issue is that if you call Render on the window before it is
realized then parenting doesnt occur properly.  i dont know if your
loop that calls the parent's Show handles this case?  I guess it does.

prabhu



More information about the vtkusers mailing list