[vtkusers] How to have multipe renderwindows using wxPython (and other wx questions).
Mathieu Malaterre
Mathieu.Malaterre at creatis.insa-lyon.fr
Fri Jul 18 04:23:44 EDT 2003
Maurice,
In addition to C.P. Botha suggestions, I would like to add:
Make sure you are using wxVTKRenderWindow from vtk and not the one ship
with wxPython:
This one is not supported anymore:
wxPython/lib/vtk.py
Instead rather use:
VTK/Wrapping/Python/vtk/wx/wxVTKRenderWindowInteractor.py
VTK/Wrapping/Python/vtk/wx/wxVTKRenderWindow.py
which can easily be loaded via:
#python sample
from vtk.wx.wxVTKRenderWindowInteractor import *
if __name__ == "__main__":
wxVTKRenderWindowInteractorConeExample()
#end python sample
Finally you'll find in this archive:
http://www.creatis.insa-lyon.fr/~malaterre/wxVTK/wxVTK.tgz
A sample program called SplitSample, which use two
wxVTKRenderWindowInteractor (this is written in C++ but shouldn't be too
hard to understand and translate to python).
HTH
mathieu
Maurice van de Rijzen wrote:
> Dear all,
>
> Recently I changed fvrom using tkInter to wxPython because. as I
> understood from different sources, wxPython is considered to be more
> 'professional' and it has more widgets. I understood that wx support is
> now in the recent versions of VTK. I can however not finf it the help
> files.
> But besides this my problem is as follows.
> Using tkinter I defined a renderWindow that had multiple renderers
> assigned to different parts of the renderwindow using the viewport
> commands. When I migrated to wx I had some problems using the
> windowInteractor using the multiple renderers.
> Then I had the idea to use the size properties of wx frame to create a
> frame with two renderwindows. I did this with the following code (I
> removed the viepwport settings):
>
>
> frame = wxFrame(None, -1, "wxRenderWindow", size=wxSize(800,800))
> widget = wxVTKRenderWindow(frame, -1, position=(1,1),size =
> (400,800),style=wxSIMPLE_BORDER)
> widget2 = wxVTKRenderWindow(frame, -1, position=(401,1), size =
> (400,800),style=wxSIMPLE_BORDER)
> widget.GetRenderWindow().AddRenderer(ren1)
> widget2.GetRenderWindow().AddRenderer(ren2)
>
> The problem now is that the in the left part of the window the correct
> renderer is displayed but not centered, it looks like the size command
> has no effect. Whereas the second widget is displayed correctly.
> Is this a problem of VTK or wx?
> How can I chech which version of VTK I'm using.
> When I instaal the latest version of VTK(Nightly) does it standard
> include wx or do I have to do something extra.
> In the current example I include the definition of 'class
> wxVTKRenderWindow' in my source beacuse otherwise I get an messgae it
> doesn't know the wxVTKRenderWindow class. But I do use
> from wxPython.wx import *
> These are a lot of questions I hope someone is able to help me with some
> of these questions.
>
> Greetings,
> Maurice
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages on-topic.
> Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
--
Mathieu Malaterre
CREATIS
28 Avenue du Doyen LEPINE
B.P. Lyon-Montchat
69394 Lyon Cedex 03
http://www.creatis.insa-lyon.fr/~malaterre/
More information about the vtkusers
mailing list