<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Dear vtk users,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have recently moved on to using wxPython from
Tkinter to create my GUI. </FONT></DIV>
<DIV><FONT face=Arial size=2>I was not sure if it was possible to create more
than one vtkRenderWindow</FONT></DIV>
<DIV><FONT face=Arial size=2>within a tk Window. Also I believe there are many
more widgets availble</FONT></DIV>
<DIV><FONT face=Arial size=2>using wxPython. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I've managed to get a simple application going
displaying a menubar, status</FONT></DIV>
<DIV><FONT face=Arial size=2>bar and wx.Panel along with a vtk window complete
with a rendered cone </FONT></DIV>
<DIV><FONT face=Arial size=2>example in it. However, when I try to increase the
number of </FONT></DIV>
<DIV><FONT face=Arial size=2>wxVTKRenderWindows OR wxVTKRenderWindowInteractors
I discover that</FONT></DIV>
<DIV><FONT face=Arial size=2>the second window does not render properly and that
there is not interaction.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>My efforts are posted below. Please could someone
give me an clue as to </FONT></DIV>
<DIV><FONT face=Arial size=2>where I'm going wrong? </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Any help would be much appreciated. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Kind regards,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Richard Rowe.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>import wx<BR>import vtk<BR>from
vtk.wx.wxVTKRenderWindowInteractor import
wxVTKRenderWindowInteractor</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>ID_ABOUT = 101<BR>ID_EXIT = 110</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>class MainWindow(wx.Frame):<BR>
def
__init__(self,parent,id,title):<BR>
wx.Frame.__init__(self,parent,wx.ID_ANY,title,size =
(600,600),<BR> style =
wx.DEFAULT_FRAME_STYLE |
wx.NO_FULL_REPAINT_ON_RESIZE)<BR>
<BR>
self.CreateStatusBar()<BR> #---------
Setting up the menu.<BR> filemenu =
wx.Menu()<BR>
filemenu.Append(ID_ABOUT, "&About", "Information about this
program")<BR>
filemenu.AppendSeparator()<BR>
filemenu.Append(ID_EXIT, "E&xit", "Terminate
program")<BR> #---------- Creating the
menu.<BR> menubar =
wx.MenuBar()<BR>
menubar.Append(filemenu,
"&File")<BR>
self.SetMenuBar(menubar)<BR>
#--------- Setting menu event
handlers.<BR> wx.EVT_MENU(self,
ID_ABOUT, self.OnAbout)<BR>
wx.EVT_MENU(self, ID_EXIT,
self.OnExit)<BR>
<BR> panel =
wx.Panel(self)<BR> #-----------
VTK<BR> widget =
wxVTKRenderWindowInteractor(panel,
-1)<BR> widget2 =
wxVTKRenderWindowInteractor(panel, -1)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> ren =
vtk.vtkRenderer()<BR> renWin =
widget.GetRenderWindow()<BR>
renWin.AddRenderer(ren)<BR>
<BR> ren2 =
vtk.vtkRenderer()<BR> renWin2 =
widget.GetRenderWindow()<BR>
renWin2.AddRenderer(ren2)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> cone =
vtk.vtkConeSource()<BR>
cone.SetResolution(12)<BR> sphere =
vtk.vtkSphereSource()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>
coneMapper =
vtk.vtkPolyDataMapper()<BR>
coneMapper.SetInput(cone.GetOutput())<BR>
<BR> sphereMapper =
vtk.vtkPolyDataMapper()<BR>
sphereMapper.SetInput(sphere.GetOutput())</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>
coneActor = vtk.vtkActor()<BR>
coneActor.SetMapper(coneMapper)<BR>
<BR> sphereActor =
vtk.vtkActor()<BR>
sphereActor.SetMapper(sphereMapper)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>
ren.AddActor(coneActor)<BR>
ren.ResetCamera()<BR>
ren.GetActiveCamera().Zoom(1.2)<BR>
<BR>
ren2.AddActor(coneActor)<BR>
ren2.ResetCamera()<BR>
ren2.GetActiveCamera().Zoom(1.2)<BR>
<BR> sizer =
wx.BoxSizer(wx.VERTICAL)<BR>
sizer.Add(widget, 1, wx.EXPAND | wx.ALL,
10)<BR> sizer.Add(widget2, 1,
wx.EXPAND | wx.ALL, 10)<BR>
self.SetSizer(sizer)<BR>
self.Layout()<BR>
<BR> self.Show(True)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> def
OnAbout(self,event):<BR> d =
wx.MessageDialog(self, "A simple display of vtkConeSource \n in wxPython","About
Simple vtk Cone", wx.OK)<BR>
d.ShowModal()<BR>
d.Destroy()<BR> def
OnExit(self,event):<BR>
self.Close(True)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>app = wx.PySimpleApp()<BR>frame = MainWindow(None,
-1, "wxPython with vtk")<BR>app.MainLoop()</FONT></DIV></BODY></HTML>