MCPcopy Create free account
hub / github.com/Kitware/VTK / SetUp

Method SetUp

Filters/Sources/Testing/Python/squadViewer.py:47–183  ·  view source on GitHub ↗

Set up squadViewer

(self)

Source from the content-addressed store, hash-verified

45 '''
46
47 def SetUp(self):
48 '''
49 Set up squadViewer
50 '''
51 def OnClosing():
52 self.root.quit()
53
54 def SetPhi(squad, win, phi):
55 squad.SetPhiRoundness(float(phi))
56 win.Render()
57
58 def SetTheta(squad, win, theta):
59 squad.SetThetaRoundness(float(theta))
60 win.Render()
61
62 def SetThickness(squad, win, thickness):
63 squad.SetThickness(float(thickness))
64 win.Render()
65
66 def SetTexture(actor, texture, win):
67 if doTexture.get():
68 actor.SetTexture(texture)
69 else:
70 actor.SetTexture(None)
71 win.Render()
72
73 def SetToroid(squad, scale, win):
74 squad.SetToroidal(toroid.get())
75 if toroid.get():
76 scale.config(state=NORMAL, fg='black')
77 else:
78 scale.config(state=DISABLED, fg='gray')
79 win.Render()
80
81 self.root = tkinter.Tk()
82 self.root.title("superquadric viewer")
83 # Define what to do when the user explicitly closes a window.
84 self.root.protocol("WM_DELETE_WINDOW", OnClosing)
85
86 # Create render window
87 self.tkrw = vtkTkRenderWidget(self.root, width=550, height=450)
88 self.tkrw.BindTkRenderWidget()
89 renWin = self.tkrw.GetRenderWindow()
90
91 # Create parameter sliders
92 #
93 prs = tkinter.Scale(self.root, from_=0, to=3.5, res=0.1,
94 orient=HORIZONTAL, label="phi roundness")
95 trs = tkinter.Scale(self.root, from_=0, to=3.5, res=0.1,
96 orient=HORIZONTAL, label="theta roundness")
97 thicks = tkinter.Scale(self.root, from_=0.01, to=1.0, res=0.01,
98 orient=HORIZONTAL, label="thickness")
99
100 # Create check buttons
101 #
102 toroid = tkinter.IntVar()
103 toroid.set(0)
104 doTexture = tkinter.IntVar()

Callers 1

DoItMethod · 0.95

Calls 15

vtkTkRenderWidgetClass · 0.90
SetTextureFunction · 0.85
BindTkRenderWidgetMethod · 0.80
packMethod · 0.80
SetPhiResolutionMethod · 0.80
SetThetaResolutionMethod · 0.80
SetDiffuseColorMethod · 0.80
SetAmbientColorMethod · 0.80
GetActiveCameraMethod · 0.80
vtkTextureClass · 0.50
vtkAppendPolyDataFunction · 0.50

Tested by

no test coverage detected