[vtkusers] VTK CVS + wxPython...

Andrea Gavana andrea.gavana at polymtl.ca
Fri Jul 23 08:01:41 EDT 2004


Hello NG,

>
> Andrea Gavana wrote:
> > that a lot of people were using wxPython + VTK on a Windows machine.
> Obviously
> > it was a mistaken. If after 3 months of presence of wxVTKRWI in the CVS no
> one
> > has complained about some strange behavior on Window$ machines, it means
> that
> > no one is using it. I had the same behavior on Win2000, XP and 98.
>
> That's not a sound conclusion.  There was a problem in the wxVTKRWI
> example, not in the code itself.  In my software for example, wxVTKRWI
> has been happily chugging along for a very long time on Linux and Windows.

That's not completely true: you modified the wxVTKRWI example in this way:

OLD CODE:
widget.Initialize()
widget.Start()

NEW CODE
widget.Enable(1)
frame.SetSize((400,400))
frame.Show(1)

This means that in other applications (like mine), if I use the call:

frame = wxFrame(None, -1, "VTK Reservoir Surface", wxPoint(100,10),
size=wxSize(400,400),
					style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxNO_FULL_REPAINT_ON_RESIZE)

widget = wxVTKRenderWindowInteractor(frame, -1,1)
hiren = vtk.vtkRenderer()
widget.GetRenderWindow().AddRenderer(hiren)


I have to use:

widget.Enable(1)
frame.SetSize((1000,900))
frame.Show(1)

And NOT the old call:

widget.Initialize()
widget.Start()


But even if use the old call (together with the frame.SetSize call), nothing is
changed. For example, the vtkOrientationMarkerWidget is frozen, and in general
the rendering process is slower than when I had VTK 4.2 and I used
wxVTKRenderWindow and wxVTKRenderWindowInteractor together. With the VTK CVS, I
can not do it anymore, I get all sort of runtime errors from Python.

> >       Now, if someone of you would like to try my application, please
> download
> > these 2 files:
>
> I don't think many people will have the time to study your code, it's
> simply too much.  It's a VERY good exercise to try and abstract an
> example of no more than 25 or 30 lines that demonstrates a SINGLE one of
> your problems.  In other words, in you case you'll make 2 or 3 small
> examples.  Also make sure that your examples make use of one or more of
> the standard VTKData datasets and have no other dependencies.

I put my Script on my website only to let you visualize the problems I'm having,
not to ask you to go through all the code. You can skip almost all the code,
the relevant part of it is the visualization in the function readandplot(self).
If you delete all the lines regarding the axis, the outline and other
beautifications, you end up with 40-50 lines of code. The rest of the Script is
only to do pre-post processing with external files, in which I/you am/are not
interested, because they work.

>
> You'll often see that you solve your own problems once you go through
> this abstraction exercise.  In the case where you don't, other people
> who use Python + VTK (and also wxPython) will be far more likely to give
> your code a hard look.

I'm trying to do it. I'm using the standard VTKData in order to reproduce the
problems, but please take into account for a moment that:

1) There is no VTKData file in which I have grid comparable to mine, and a bunch
of actors like my application. Again, the grid construction process is fairly
different, because I use vtkFloatArray() and its friends. It seems to me that
there is no Python example on a Structured Grid with a standard VTKData file.

2) I have still not found where is the problem on my application (the questions
are: why the vtkOrientationMarkerWidget does not follow the camera? Why the
rendering process is solwer? Why after some interactions the window gets
frozen?). Where it can be? The grid construction process? The vtkTransform? All
the text actors? It is not so easy, at least for an unexperienced user like me.

> One last tip: chin up!

That is easy to say when everything goes well. After 3/4 weeks of work, learning
Python/VTK/wx, everything seemed nice. Now it is less nice. But the work
continue.

Anyway, thank you a lot Charl, you taught me A LOT of things. Thanks for your
useful suggestions.

In any case, all suggestions/pointers/helps are really welcome. Thanks to you
all.

Andrea.




More information about the vtkusers mailing list