[vtkusers] wxVTKRenderWindow.py Problems

Siddartha Krishnan sidd.krish at gmail.com
Thu Jun 15 15:08:25 EDT 2006


Hi Again,

I am still having problems compiling both the version which shipped  
with my release of VTK and the latest version in the CVS. I get the  
following errors:

X Error of failed request:  BadWindow (invalid Window parameter)
   Major opcode of failed request:  2 (X_ChangeWindowAttributes)
   Resource id in failed request:  0x8001c10
   Serial number of failed request:  6
   Current serial number in output stream:  8

I am not sure how to solve this problem, any help is greatly  
appreciated.
Thanks,

Siddartha


PS My code is:


from wxPython.wx import *
import vtk
from vtk.wx.wxVTKRenderWindowInteractor import  
wxVTKRenderWindowInteractor

def wxVTKRenderWindowInteractorConeExample():
     """Like it says, just a simple example
     """
     # every wx app needs an app
     app = wxPySimpleApp()

     # create the top-level frame, sizer and wxVTKRWI
     frame = wxFrame(None, -1, "wxRenderWindow", size=wxSize(400,400))
     widget = wxVTKRenderWindowInteractor(frame,-1)
     sizer = wxBoxSizer(wxVERTICAL)
     sizer.Add(widget, 1, wxEXPAND)
     frame.SetSizer(sizer)
     frame.Layout()

     # It would be more correct (API-wise) to call widget.Initialize 
() and
     # widget.Start() here, but Initialize() calls RenderWindow.Render 
().
     # That Render() call will get through before we can setup the
     # RenderWindow() to render via the wxWidgets-created context; this
     # causes flashing on some platforms and downright breaks things on
     # other platforms.  Instead, we call widget.Enable().  This means
     # that the RWI::Initialized ivar is not set, but in THIS  
SPECIFIC CASE,
     # that doesn't matter.
     widget.Enable(1)

     widget.AddObserver("ExitEvent", lambda o,e,f=frame: f.Close())

     ren = vtk.vtkRenderer()
     widget.GetRenderWindow().AddRenderer(ren)

     cone = vtk.vtkConeSource()
     cone.SetResolution(8)

     coneMapper = vtk.vtkPolyDataMapper()
     coneMapper.SetInput(cone.GetOutput())

     coneActor = vtk.vtkActor()
     coneActor.SetMapper(coneMapper)

     ren.AddActor(coneActor)

     # show the window
     frame.Show(1)

     app.MainLoop()

if __name__ == "__main__":
     wxVTKRenderWindowInteractorConeExample()




On 15-Jun-06, at 12:50 PM, Mathieu Malaterre wrote:

> Siddartha Krishnan wrote:
>> Hi,
>> I am having problems compiling the example for  
>> wxVTKRenderWindow.py on the http://wxvtk.sourceforge.net/ site.
>> I am running a Mac OS X 10.4 with vtk 5 and wxWindows 2.6.
>
>
> All I am doing is pointing to the latest revision in the CVS of VTK:
>
> Pass your pointer over the url, you'll the link is:
> http://www.itk.org/cgi-bin/viewcvs.cgi/*checkout*/Wrapping/Python/ 
> vtk/wx/wxVTKRenderWindow.py?rev=HEAD&cvsroot=VTK&content-type=text/ 
> x-python
>
> Even if this script has not changed in a while, it is usually a  
> better idea to use the one shipped with your release of VTK, at:
>
> VTK/Wrapping/Python/vtk/wx/wxVTKRenderWindow.py
>
> HTH
> Mathieu




More information about the vtkusers mailing list