Enabling the use of masks for wxGTK in some of the demos

wxWindow.GetHandle returns the X-Window instead of the GtkWidget
pointer so the X-Window can be given to other Python modules such as
VTK.

wxPython.lib.vtk updated to get the window handle at widget creation
instead of in the constructor.

other updates


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5147 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
1999-12-29 22:10:32 +00:00
parent cfe17b7435
commit 54b9688254
16 changed files with 231 additions and 10510 deletions

View File

@@ -28,15 +28,14 @@ import math
#----------------------------------------------------------------------
class wxVTKRenderWindow(wxWindow):
class wxVTKRenderWindow(wxScrolledWindow):
def __init__(self, parent, id, position=wxDefaultPosition,
size=wxDefaultSize, style=0):
wxWindow.__init__(self, parent, id, position, size, style)
wxScrolledWindow.__init__(self, parent, id, position, size, style)
self.renderWindow = vtkRenderWindow()
hdl = self.GetHandle()
self.renderWindow.SetWindowInfo(str(hdl))
EVT_WINDOW_CREATE(self, self.OnCreateWindow)
EVT_LEFT_DOWN (self, self.SaveClick)
EVT_MIDDLE_DOWN(self, self.SaveClick)
@@ -44,7 +43,7 @@ class wxVTKRenderWindow(wxWindow):
EVT_LEFT_UP (self, self.Release)
EVT_MIDDLE_UP (self, self.Release)
EVT_RIGHT_UP (self, self.Release)
EVT_MOTION(self, self.MouseMotion)
EVT_MOTION (self, self.MouseMotion)
def GetRenderer(self):
@@ -60,6 +59,14 @@ class wxVTKRenderWindow(wxWindow):
dc = wxPaintDC(self)
self.renderWindow.Render()
def OnCreateWindow(self, event):
hdl = self.GetHandle()
self.renderWindow.SetWindowInfo(str(hdl))
def OnEraseBackground(self, event):
pass
def SaveClick(self, event):
self.prev_x, self.prev_y = event.GetPositionTuple()
@@ -109,50 +116,3 @@ class wxVTKRenderWindow(wxWindow):
## testcode is now in the demo ##
## if __name__ == '__main__':
## class TestFrame(wxFrame):
## def __init__(self, parent):
## wxFrame.__init__(self, parent, -1, "VTK Test", size=(450,450))
## rw = wxVTKRenderWindow(self, -1)
## # Get the render window
## renWin = rw.GetRenderWindow()
## # Next, do the VTK stuff
## ren = vtkRenderer()
## renWin.AddRenderer(ren)
## cone = vtkConeSource()
## cone.SetResolution(80)
## coneMapper = vtkPolyDataMapper()
## coneMapper.SetInput(cone.GetOutput())
## coneActor = vtkActor()
## coneActor.SetMapper(coneMapper)
## ren.AddActor(coneActor)
## coneMapper.GetLookupTable().Build()
## # Create a scalar bar
## scalarBar = vtkScalarBarActor()
## scalarBar.SetLookupTable(coneMapper.GetLookupTable())
## scalarBar.SetTitle("Temperature")
## scalarBar.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport()
## scalarBar.GetPositionCoordinate().SetValue(0.1, 0.01)
## scalarBar.SetOrientationToHorizontal()
## scalarBar.SetWidth(0.8)
## scalarBar.SetHeight(0.17)
## ren.AddActor2D(scalarBar)
## class TestApp(wxApp):
## def OnInit(self):
## f = TestFrame(None)
## self.SetTopWindow(f)
## f.Show(true)
## return true
## app = TestApp(0)
## app.MainLoop()