[vtkusers] VTK + wxPython + wx.aui X error

Nicola Creati ncreati at inogs.it
Fri Feb 27 08:56:35 EST 2009


Hello,
I'm developing an application using VTK python (version 5.2.1) binding and
wxPython (2.8.9.2).
The main window frame is managed by wx.aui.
In the central panel there is a wxVTKRenderWindowInteractor (win1). In
another panel I create another wxVTKRenderWindowInteractor (win2). The
second panel (win2) is a float panel. If I try to dock the second panel
(win2) to the first one (win1) on Linux I get a X Window System Error and
the program close. The same program works perfectly under Windows.
I'm attaching an example script that reproduce the error:
Thank you.

Nicola

import vtk
import wx
import wx.aui
from wxVTKRenderWindowInteractor import *
#--------------------------------------------------------------------------------
class PlotCanvas(wx.Panel):
  def __init__(self, parent, id):
    wx.Panel.__init__(self, parent, id, size=(350,350))

    self.parent = parent

    self.widget = wxVTKRenderWindowInteractor(self, -1)
    self.widget.Enable(1)
    self.widget.SetRenderWhenDisabled(True)
    
    self.ren = vtk.vtkRenderer()
    self.widget.GetRenderWindow().AddRenderer(self.ren)
    
    self.widget._Iren.SetPicker(None)
         
    sizer = wx.BoxSizer(wx.VERTICAL)
    sizer.Add(self.widget, 1, wx.EXPAND)
    self.SetSizer(sizer)
    self.Layout()    

#--------------------------------------------------------------------------------
class Test(wx.Frame):
    
  def __init__(self, parent, id):

    wx.Frame.__init__(self, parent, id=-1, title="AUI Test", pos=(0,0),
      size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE | wx.SUNKEN_BORDER |
      wx.CLIP_CHILDREN|wx.MAXIMIZE)
       
    self._mgr = wx.aui.AuiManager()
    self._mgr.SetManagedWindow(self)
    
    self.SetMinSize(wx.Size(400, 300))
    
    self._mgr.AddPane(self.createPlotFrame(),
wx.aui.AuiPaneInfo().Name("win1").
                      CenterPane())
    self._mgr.AddPane(self.createPlotFrame(), wx.aui.AuiPaneInfo().
                      Name("win2").Caption("win2").
                      Left().Position(0).Float())

    self.Bind(wx.EVT_CLOSE, self.onExit)

    self.perspective_default = self._mgr.SavePerspective()

    self._mgr.Update()
      
  def createPlotFrame(self):
    win2 = PlotCanvas(self, -1)
    return win2
   
  def onExit(self, event):
    self.Destroy()

#--------------------------------------------------------------------------------
if __name__ == "__main__":
  app = wx.App(0)
  main = Test(None, wx.ID_ANY)
  main.Show()
  main.Maximize()
  app.MainLoop()


-- 
View this message in context: http://www.nabble.com/VTK-%2B-wxPython-%2B-wx.aui-X-error-tp22246344p22246344.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list