[vtkusers] [VTK + wxPython + Linux] bug : Reparent with widget containing wxVTKRenderWindow

Benoit Regrain benoit.regrain at creatis.insa-lyon.fr
Tue Feb 4 10:29:29 EST 2003


I have a program containing one wxVTKRenderWindow (see below). 
The choice in the menu offers possibility to move the wxVTKRenderWindow 
from one panel to an other panel placed around a splitter window. 

To change the panel containing the wxVTKRenderWindow, I'm using the Reparent
method. At this moment, a BadWindow mesage appears from GTK (serail 48 error_code 3 minor_code 0)
I'm certain that the Reparent method of wxWindow is the source of problem, but I haven't found solution.

The goal of that is to move widget containing wxVTKRenderWindow object from one panel to an other (the widget can have a complex interface with VTK and wxWindow elements)

Greatings
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Program
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
from wxPython.wx import *
from vtkpython import *
from wxVTKRenderWindow import wxVTKRenderWindow

if __name__ == '__main__':
 import sys
 import os

 class TestApp(wxApp):
  def OnInit(self):
   self.frame=wxFrame(None,-1,"dvwGrid",size=(640,480))

   self.splitter=wxSplitterWindow(self.frame,-1)
   self.left=wxPanel(self.splitter,-1)
   self.right=wxPanel(self.splitter,-1)
   self.splitter.SplitVertically(self.left,self.right,50)
   self.frame.Show(true)

   self.onLeft=true
   self.window=wxVTKRenderWindow(self.left,-1)

   self.MakeMenu()

   EVT_SIZE(self.left,self.OnSize)
   EVT_SIZE(self.right,self.OnSize)

   return(true)

  def MakeMenu(self):
   menu=wxMenu()
   menu.Append(6551,"Flit window")
   mb=wxMenuBar()
   mb.Append(menu,"Edit")
   self.frame.SetMenuBar(mb)
   EVT_MENU(self.frame,6551,self.OnMenu)

  def OnSize(self,event=None):
   if(self.onLeft):
    self.window.SetSize(self.left.GetSize())
   else:
    self.window.SetSize(self.right.GetSize())

  def OnMenu(self,event):
   if(self.onLeft):
    self.window.Reparent(self.right)
   else:
    self.window.Reparent(self.left)
   self.onLeft=not self.onLeft
   self.OnSize()

 #lancement de l'application
 app = TestApp(0)
 app.MainLoop()

 
-----------------------------------------------------------------
Benoit Regrain
Ingénieur d'études CNRS (Creatis)
email : regrain at creatis.insa-lyon.fr
INSA - Bâtiment Blaise Pascal
7, avenue Jean Capelle
F - 69621 Villeurbanne Cedex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20030204/7a1d24c7/attachment.htm>


More information about the vtkusers mailing list