[vtkusers] [wxPython + VTK] bug found in wxVTKRenderWindow.py generating GDK warnings

Mathieu Malaterre mathieu.malaterre at kitware.com
Tue Mar 23 13:43:41 EST 2004


Benoit,

	I have add a new bug for that, I am using fedora and could reproduce 
the bug. The patch looks ok to me.

	Charl, Prabhu comments ?

http://vtk.org/Bug/bug.php?op=show&bugid=697

Thanks,
Mathieu

Benoit Regrain wrote:
> Hi,
>  
> I have found the bug that generates the following warning when the 
> window isn't immediately visible
>    (test.py:4677): Gdk-WARNING **: gdkdrawable-x11.c:1012 drawable is 
> not a pixmap or window
> This message is visible for RedHat 7.3, RedHat 9.0 and Fedora.
>  
> What is the solution :
>  - When we call the method GetHandle() for an invisible wxWindow, we 
> obtain the precedent message.
>    Thus, the goal is to report the call when the window will be visible 
> => in the OnPaint method.
>    So, we remove the call to GetHandle() in the constructor of the 
> wxVTKRenderWindow.
>  - The OnPaint method calls Render() that searchs if the current handle 
> is good before rendering.
>    So, in the Render() method, we must test if the window can have an 
> handle. We can call the method GetHandle() in the 2 following cases :
>    + If the method is called from the OnPaint, the wx method 
> GetUpdateRegion() will returns a not empty region. So, we will have an 
> handle.
>    + If the method is called by the user, the wx method 
> GetUpdateRegion() will returns an empty region. But if the window is 
> visible, we
>       already have a handle (variable self.__handle != None)
>   
> File joined :
>  - diff between the old and the new wxVTKRenderWindow (after thes 
> modifications)
>  - a python test file showing the first step (in my solution).
>  
> Cheers
>  
> -----------------------------------------------------------------
> Benoit Regrain
> Ingénieur d'études CNRS (Creatis)
> email : regrain at creatis.insa-lyon.fr <mailto:regrain at creatis.insa-lyon.fr>
> phone : (+33) (0) 4.72.43.82.58
> fax : (+33) (0) 4.72.43.85.26
> INSA - Bâtiment Blaise Pascal
> 7, avenue Jean Capelle
> F - 69621 Villeurbanne Cedex
> -----------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> from wxPython.wx import *
> from wxVTKRenderWindow import wxVTKRenderWindow
> 
> ############################################################################
> # Test:
> if __name__ == '__main__':
> 	import sys
> 	import os
> 
> 	class TestApp(wxApp):
> 		def OnInit(self):
> 			self.MakeFrame()
> 			return true
> 
> 		def MakeFrame(self,event=None):
> 			self.frame=wxFrame(None,-1,"wxVTK",size=(640,480))
> 
> 			# Don't work !!!
> 			self.book=wxNotebook(self.frame,-1,size=(630,470))
> 			self.book.AddPage(self.MakeGridPanel(self.book),"page")
> 
> 			# Work !!!
> 			#self.MakeGridPanel(self.frame)
> 
> 			self.frame.Show(true)
> 
> 		def MakeGridPanel(self,parent):
> 			self.grid=wxVTKRenderWindow(parent,-1,size=(600,400))
> 
> 			return(self.grid)
> 
> 	#lancement de l'application
> 	app = TestApp(0)
> 	app.MainLoop()
> 






More information about the vtkusers mailing list