[vtkusers] wxVTKRenderWindowInteractor outside of wxFrame

gregthom992 gregthom992 at gmail.com
Mon Apr 13 16:14:41 EDT 2015


Hi All, 

I am having trouble setting up a framework for use with
wxVTKRenderWindowInteractor. Basically I use a
aui.AuiManager with four panes which should each carry a  window defined by
wxVTKRenderWindowInteractor. 
Can someone help explain why my MWE below only shows the vtk render windows
outside of the frame instead of within the four panes ?

Thanks 

Greg Thom


import vtk
from vtk.wx.wxVTKRenderWindowInteractor import wxVTKRenderWindowInteractor
import wx
import wx.lib.agw.aui as aui




class MyFrame(wx.Frame):
    """ Class of Frame. """
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title)
        self.Show()
        self.__mgr = aui.AuiManager(self,
agwFlags=aui.AUI_MGR_USE_NATIVE_MINIFRAMES|aui.AUI_MGR_ALLOW_ACTIVE_PANE)
        # create four views
        style = wx.WANTS_CHARS or wx.NO_FULL_REPAINT_ON_RESIZE
        self.__viewInteractor1 = wxVTKRenderWindowInteractor(self,
wx.ID_ANY, style=style)
        self.__Renderer1 = vtk.vtkRenderer()
       
self.__viewInteractor1.GetRenderWindow().AddRenderer(self.__Renderer1)
        self.__viewInteractor1.Enable(1)

        self.__viewInteractor2 = wxVTKRenderWindowInteractor(self,
wx.ID_ANY, style=style)
        self.__Renderer2 = vtk.vtkRenderer()
       
self.__viewInteractor2.GetRenderWindow().AddRenderer(self.__Renderer2)
        self.__viewInteractor2.Enable(1)

        self.__viewInteractor3 = wxVTKRenderWindowInteractor(self,
wx.ID_ANY, style=style)
        self.__Renderer3 = vtk.vtkRenderer()
       
self.__viewInteractor3.GetRenderWindow().AddRenderer(self.__Renderer3)
        self.__viewInteractor3.Enable(1)

        self.__viewInteractor4 = wxVTKRenderWindowInteractor(self,
wx.ID_ANY, style=style)
        self.__Renderer4 = vtk.vtkRenderer()
       
self.__viewInteractor4.GetRenderWindow().AddRenderer(self.__Renderer4)
        self.__viewInteractor4.Enable(1)

        self.viewpane1 = self.__mgr.AddPane(self.__viewInteractor1,
aui.AuiPaneInfo().Name('View
1').Center().Row(0).CloseButton(False).MaximizeButton(True).DestroyOnClose(False)
)
        self.viewpane2 = self.__mgr.AddPane(self.__viewInteractor2,
aui.AuiPaneInfo().Name('View
2').Center().Row(0).CloseButton(False).MaximizeButton(True).DestroyOnClose(False)
)
        self.viewpane3 = self.__mgr.AddPane(self.__viewInteractor3,
aui.AuiPaneInfo().Name('View
3').Center().Row(1).CloseButton(False).MaximizeButton(True).DestroyOnClose(False)
)
        self.viewpane4 = self.__mgr.AddPane(self.__viewInteractor4,
aui.AuiPaneInfo().Name('View
4').Center().Row(1).CloseButton(False).MaximizeButton(True).DestroyOnClose(False)
)


        self.__mgr.Update()

        # image data
        imagedata = vtk.vtkImageData()


        # View3D
        self.__view3D = vtk.vtkImageViewer2()
        self.__view3D.GlobalWarningDisplayOff()
        self.__view3D.SetInput(imagedata)
        self.__view3D.SetupInteractor(self.__viewInteractor4)
       
self.__view3D.SetRenderWindow(self.__viewInteractor4.GetRenderWindow())

        # View2D - XY plane
        self.__viewxy = vtk.vtkImageViewer2()
        self.__viewxy.GlobalWarningDisplayOff()
        self.__viewxy.SetInput(imagedata)
        self.__viewxy.SetupInteractor(self.__viewInteractor1)
       
self.__viewxy.SetRenderWindow(self.__viewInteractor1.GetRenderWindow())
        self.__viewxy.SetSliceOrientationToXY()

        # View2D - YZ plane
        self.__viewyz = vtk.vtkImageViewer2()
        self.__viewyz.GlobalWarningDisplayOff()
        self.__viewyz.SetInput(imagedata)
        self.__viewyz.SetupInteractor(self.__viewInteractor2)
       
self.__viewyz.SetRenderWindow(self.__viewInteractor2.GetRenderWindow())
        self.__viewyz.SetSliceOrientationToYZ()

        # View2D - XZ plane
        self.__viewxz = vtk.vtkImageViewer2()
        self.__viewxz.GlobalWarningDisplayOff()
        self.__viewxz.SetInput(imagedata)
        self.__viewxz.SetupInteractor(self.__viewInteractor3)
       
self.__viewxz.SetRenderWindow(self.__viewInteractor3.GetRenderWindow())
        self.__viewxz.SetSliceOrientationToXZ()


app = wx.App(False)
frame = MyFrame(None, 'MWE')
app.MainLoop()





--
View this message in context: http://vtk.1045678.n5.nabble.com/wxVTKRenderWindowInteractor-outside-of-wxFrame-tp5731444.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list