]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/viewer_basics.py
added test for writing empty value to the config
[wxWidgets.git] / wxPython / demo / viewer_basics.py
CommitLineData
f6bcfd97
BP
1from wxPython.wx import *
2from wxPython.lib import vtk
3
4#---------------------------------------------------------------------------
5class VtkFrame(wxFrame):
6 """
7 Simple example VTK window that contains a cone.
8 """
9 def __init__(self, parent, id, title):
10 wxFrame.__init__(self, parent,id,title, size=(450, 300))
11 win = vtk.wxVTKRenderWindow(self, -1)
12
13 renWin = win.GetRenderWindow()
14
15 ren = vtk.vtkRenderer()
16 renWin.AddRenderer(ren)
17 cone = vtk.vtkConeSource()
18 coneMapper = vtk.vtkPolyDataMapper()
19 coneMapper.SetInput(cone.GetOutput())
20 coneActor = vtk.vtkActor()
21 coneActor.SetMapper(coneMapper)
22 ren.AddActor(coneActor)
493f1553 23
f6bcfd97
BP
24#---------------------------------------------------------------------------
25wxEVT_ADD_CONE = 25015
26
27def EVT_ADD_CONE(win, func):
28 win.Connect(-1, -1, wxEVT_ADD_CONE, func)
29
493f1553 30
f6bcfd97
BP
31class AddCone(wxPyEvent):
32 def __init__(self):
33 wxPyEvent.__init__(self)
34 self.SetEventType(wxEVT_ADD_CONE)
35
493f1553 36
f6bcfd97
BP
37class HiddenCatcher(wxFrame):
38 """
39 The "catcher" frame in the second thread.
40 It is invisible. It's only job is to receive
493f1553 41 Events from the main thread, and create
f6bcfd97 42 the appropriate windows.
493f1553 43 """
f6bcfd97 44 def __init__(self):
493f1553 45 wxFrame.__init__(self, None, -1, '')
f6bcfd97
BP
46 EVT_ADD_CONE(self, self.AddCone)
47
493f1553 48 def AddCone(self,evt):
f6bcfd97 49 add_cone()
493f1553
RD
50
51
f6bcfd97 52#---------------------------------------------------------------------------
493f1553 53
f6bcfd97
BP
54class SecondThreadApp(wxApp):
55 """
56 wxApp that lives in the second thread.
493f1553 57 """
f6bcfd97
BP
58 def OnInit(self):
59 catcher = HiddenCatcher()
60 #self.SetTopWindow(catcher)
61 self.catcher =catcher
62 return true
493f1553 63
f6bcfd97
BP
64#---------------------------------------------------------------------------
65
493f1553
RD
66def add_cone():
67 frame = VtkFrame(None, -1, "Cone")
f6bcfd97 68 frame.Show(true)
493f1553 69