parameters: (self, parent, ID, *args, **kw)
docstring: Default class constructor.
          @param parent: parent window
          @param ID: window id
          @param **kw: wxPython keywords (position, size, style) plus the
          'stereo' keyword
docstring_summary: Default class constructor.
docstring_tokens: Default class constructor .
function: def __init__(self, parent, ID, *args, **kw):
          """Default class constructor.
          @param parent: parent window
          @param ID: window id
          @param **kw: wxPython keywords (position, size, style) plus the
          'stereo' keyword
          """
          # private attributes
          self.__RenderWhenDisabled = 0
  
          # First do special handling of some keywords:
          # stereo, position, size, width, height, style
  
          try:
              stereo = bool(kw['stereo'])
              del kw['stereo']
          except KeyError:
              stereo = False
  
          try:
              position = kw['position']
              del kw['position']
          except KeyError:
              position = wx.DefaultPosition
  
          try:
              size = kw['size']
              del kw['size']
          except KeyError:
              try:
                  size = parent.GetSize()
              except AttributeError:
                  size = wx.DefaultSize
  
          # wx.WANTS_CHARS says to give us e.g. TAB
          # wx.NO_FULL_REPAINT_ON_RESIZE cuts down resize flicker under GTK
          style = wx.WANTS_CHARS | wx.NO_FULL_REPAINT_ON_RESIZE
  
          try:
              style = style | kw['style']
              del kw['style']
          except KeyError:
              pass
  
          # the enclosing frame must be shown under GTK or the windows
          #  don't connect together properly
          if wx.Platform != '__WXMSW__':
              l = []
              p = parent
              while p: # make a list of all parents
                  l.append(p)
                  p = p.GetParent()
              l.reverse() # sort list into descending order
              for p in l:
                  p.Show(1)
  
          if baseClass.__name__ == 'GLCanvas':
              # code added by cpbotha to enable stereo and double
              # buffering correctly where the user requests this; remember
              # that the glXContext in this case is NOT allocated by VTK,
              # but by WX, hence all of this.
  
              # Initialize GLCanvas with correct attriblist
              attribList = [wx.glcanvas.WX_GL_RGBA,
                            wx.glcanvas.WX_GL_MIN_RED, 1,
                            wx.glcanvas.WX_GL_MIN_GREEN, 1,
                            wx.glcanvas.WX_GL_MIN_BLUE, 1,
                            wx.glcanvas.WX_GL_DEPTH_SIZE, 16,
                            wx.glcanvas.WX_GL_DOUBLEBUFFER]
              if stereo:
                  attribList.append(wx.glcanvas.WX_GL_STEREO)
  
              try:
                  baseClass.__init__(self, parent, ID, pos=position, size=size,
                                     style=style,
                                     attribList=attribList)
              except wx.PyAssertionError:
                  # visual couldn't be allocated, so we go back to default
                  baseClass.__init__(self, parent, ID, pos=position, size=size,
                                     style=style)
                  if stereo:
                      # and make sure everyone knows that the stereo
                      # visual wasn't set.
                      stereo = 0
  
          else:
              baseClass.__init__(self, parent, ID, pos=position, size=size,
                                 style=style)
  
          # create the RenderWindow and initialize it
          self._Iren = vtkGenericRenderWindowInteractor()
          self._Iren.SetRenderWindow( vtkRenderWindow() )
          self._Iren.AddObserver('CreateTimerEvent', self.CreateTimer)
          self._Iren.AddObserver('DestroyTimerEvent', self.DestroyTimer)
          self._Iren.GetRenderWindow().AddObserver('CursorChangedEvent',
                                                   self.CursorChangedEvent)
  
          try:
              self._Iren.GetRenderWindow().SetSize(size.width, size.height)
          except AttributeError:
              self._Iren.GetRenderWindow().SetSize(size[0], size[1])
  
          if stereo:
              self._Iren.GetRenderWindow().StereoCapableWindowOn()
              self._Iren.GetRenderWindow().SetStereoTypeToCrystalEyes()
  
          self.__handle = None
  
          self.BindEvents()
  
          # with this, we can make sure that the reparenting logic in
          # Render() isn't called before the first OnPaint() has
          # successfully been run (and set up the VTK/WX display links)
          self.__has_painted = False
  
          # set when we have captured the mouse.
          self._own_mouse = False
          # used to store WHICH mouse button led to mouse capture
          self._mouse_capture_button = 0
  
          # A mapping for cursor changes.
          self._cursor_map = {0: wx.CURSOR_ARROW, # VTK_CURSOR_DEFAULT
                              1: wx.CURSOR_ARROW, # VTK_CURSOR_ARROW
                              2: wx.CURSOR_SIZENESW, # VTK_CURSOR_SIZENE
                              3: wx.CURSOR_SIZENWSE, # VTK_CURSOR_SIZENWSE
                              4: wx.CURSOR_SIZENESW, # VTK_CURSOR_SIZESW
                              5: wx.CURSOR_SIZENWSE, # VTK_CURSOR_SIZESE
                              6: wx.CURSOR_SIZENS, # VTK_CURSOR_SIZENS
                              7: wx.CURSOR_SIZEWE, # VTK_CURSOR_SIZEWE
                              8: wx.CURSOR_SIZING, # VTK_CURSOR_SIZEALL
                              9: wx.CURSOR_HAND, # VTK_CURSOR_HAND
                              10: wx.CURSOR_CROSS, # VTK_CURSOR_CROSSHAIR
                             }
function_tokens: def __init__ ( self , parent , ID , * args , * * kw ) : # private attributes self . __RenderWhenDisabled = 0 # First do special handling of some keywords: # stereo, position, size, width, height, style try : stereo = bool ( kw [ 'stereo' ] ) del kw [ 'stereo' ] except KeyError : stereo = False try : position = kw [ 'position' ] del kw [ 'position' ] except KeyError : position = wx . DefaultPosition try : size = kw [ 'size' ] del kw [ 'size' ] except KeyError : try : size = parent . GetSize ( ) except AttributeError : size = wx . DefaultSize # wx.WANTS_CHARS says to give us e.g. TAB # wx.NO_FULL_REPAINT_ON_RESIZE cuts down resize flicker under GTK style = wx . WANTS_CHARS | wx . NO_FULL_REPAINT_ON_RESIZE try : style = style | kw [ 'style' ] del kw [ 'style' ] except KeyError : pass # the enclosing frame must be shown under GTK or the windows #  don't connect together properly if wx . Platform != '__WXMSW__' : l = [ ] p = parent while p : # make a list of all parents l . append ( p ) p = p . GetParent ( ) l . reverse ( ) # sort list into descending order for p in l : p . Show ( 1 ) if baseClass . __name__ == 'GLCanvas' : # code added by cpbotha to enable stereo and double # buffering correctly where the user requests this; remember # that the glXContext in this case is NOT allocated by VTK, # but by WX, hence all of this. # Initialize GLCanvas with correct attriblist attribList = [ wx . glcanvas . WX_GL_RGBA , wx . glcanvas . WX_GL_MIN_RED , 1 , wx . glcanvas . WX_GL_MIN_GREEN , 1 , wx . glcanvas . WX_GL_MIN_BLUE , 1 , wx . glcanvas . WX_GL_DEPTH_SIZE , 16 , wx . glcanvas . WX_GL_DOUBLEBUFFER ] if stereo : attribList . append ( wx . glcanvas . WX_GL_STEREO ) try : baseClass . __init__ ( self , parent , ID , pos = position , size = size , style = style , attribList = attribList ) except wx . PyAssertionError : # visual couldn't be allocated, so we go back to default baseClass . __init__ ( self , parent , ID , pos = position , size = size , style = style ) if stereo : # and make sure everyone knows that the stereo # visual wasn't set. stereo = 0 else : baseClass . __init__ ( self , parent , ID , pos = position , size = size , style = style ) # create the RenderWindow and initialize it self . _Iren = vtkGenericRenderWindowInteractor ( ) self . _Iren . SetRenderWindow ( vtkRenderWindow ( ) ) self . _Iren . AddObserver ( 'CreateTimerEvent' , self . CreateTimer ) self . _Iren . AddObserver ( 'DestroyTimerEvent' , self . DestroyTimer ) self . _Iren . GetRenderWindow ( ) . AddObserver ( 'CursorChangedEvent' , self . CursorChangedEvent ) try : self . _Iren . GetRenderWindow ( ) . SetSize ( size . width , size . height ) except AttributeError : self . _Iren . GetRenderWindow ( ) . SetSize ( size [ 0 ] , size [ 1 ] ) if stereo : self . _Iren . GetRenderWindow ( ) . StereoCapableWindowOn ( ) self . _Iren . GetRenderWindow ( ) . SetStereoTypeToCrystalEyes ( ) self . __handle = None self . BindEvents ( ) # with this, we can make sure that the reparenting logic in # Render() isn't called before the first OnPaint() has # successfully been run (and set up the VTK/WX display links) self . __has_painted = False # set when we have captured the mouse. self . _own_mouse = False # used to store WHICH mouse button led to mouse capture self . _mouse_capture_button = 0 # A mapping for cursor changes. self . _cursor_map = { 0 : wx . CURSOR_ARROW , # VTK_CURSOR_DEFAULT 1 : wx . CURSOR_ARROW , # VTK_CURSOR_ARROW 2 : wx . CURSOR_SIZENESW , # VTK_CURSOR_SIZENE 3 : wx . CURSOR_SIZENWSE , # VTK_CURSOR_SIZENWSE 4 : wx . CURSOR_SIZENESW , # VTK_CURSOR_SIZESW 5 : wx . CURSOR_SIZENWSE , # VTK_CURSOR_SIZESE 6 : wx . CURSOR_SIZENS , # VTK_CURSOR_SIZENS 7 : wx . CURSOR_SIZEWE , # VTK_CURSOR_SIZEWE 8 : wx . CURSOR_SIZING , # VTK_CURSOR_SIZEALL 9 : wx . CURSOR_HAND , # VTK_CURSOR_HAND 10 : wx . CURSOR_CROSS , # VTK_CURSOR_CROSSHAIR }