[vtkusers] VTK CVS + wxPython...

Andrea Gavana andrea.gavana at polymtl.ca
Fri Jul 23 03:59:28 EDT 2004


Hello NG,

      after some hard work, nothing seems changed in my application. I just
encountered some problems using wxPython + VTK; by viewing the wide use of
wx_Things on the net (it seems to me that it will replace TK), I have imagined
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.
      Anyway, I really like wxPython for all the nice widgets/accessories it
has, and it seems to me quite intuitive. For this I still stand on it, even if
(probably) removing the VTK 4.2 version from Enthought in order to install the
VTK from CVS was a big mistake. At least, before, almost everything worked
(only the point picker, "P" key on the keyboard, had a bug). And even if
someone of you could think that is not correct, I could use wxVTKRenderWindow
and wxVTKRenderWindowInteractor together. It was probably wrong, but it worked.
      Now, if someone of you would like to try my application, please download
these 2 files:

http://xoomer.virgilio.it/infinity77/MSE_22_SET.zip
http://xoomer.virgilio.it/infinity77/myproject.zip

Sorry to have splitted the directory in 2 zip files, but my internet site did
not allow me to upload a 2 MB file in one shot.

The first one contains the GRID files with the point coordinate specification,
while the second one contains all the Python/Pyfort/VTK files in order to run
the application. Please notify me if you're having some problems in running the
application. In order to run the application, the main script is Script2.py.
The program will ask you to select a DATA file (via a FileDialog), there is one
included in the directory "myproject". It scans this DATA file and then it will
ask you for a GRID file, thas is in zipped in the file MSE_22_SET.zip. Then it
does some calculations/rearrangements, and it shows up a wx frame with a VTK
window in it. Please note these 3 things:

1) Interaction is fairly slow (even if it is a small 3D grid, I can't imagine
with bigger grids); you can easily see the difference by using
wxVTKRenderWindow instead of wxVTKRenderWindowInteractor;

2) The vtkOrientationMarkerWidget will not work, whatever I do, it does not
follow the camera. It is frozen;

3) If you comment out the 3 lines:
hiren.GetActiveCamera().Zoom(1.5)
hiren.GetActiveCamera().Elevation(135.0)
hiren.GetActiveCamera().Roll(180.0)
At lines 907-908-909 of the Script2.py, and you some interaction for a while
(rotate/pan/zoom), after a while the window will freeze and you will not able
to do any other interaction, not even close the window. You have to kill the
application.

Probably there is something else, but not I'm a little disappointed about
everything. I should work and study Python/C++ a little more, probably.

Thanks to everyone for all suggestions/pointers.
Please try my application! Every suggestion/enhancement/good style programming
tips are really really really welcome.

Andrea.


Selon "Charl P. Botha" <c.p.botha at ewi.tudelft.nl>:

> Andrea Gavana wrote:
> > Traceback (most recent call last):
> >   File "C:\Python23\myproject\wxVTKRenderWindowInteractor.py", line 290, in
> > OnButtonUp
> >     self.ReleaseMouse()
> >   File "C:\Python23\Lib\site-packages\wxPython\windows.py", line 647, in
> > ReleaseMouse
> >     val = windowsc.wxWindow_ReleaseMouse(self, *_args, **_kwargs)
> > wxPython.wxc.wxPyAssertionError: C++ assertion "GetCapture() == this"
> failed in
> > e:\Projects\wx2.4\src\common\wincmn.cpp(2006): attempt to release mouse,
> but
> > this window hasn't captured it
>
> Argh, this is due to the mouse capturing.  I usually switch that off as
> the logic isn't failsafe yet.
>
> > No idea on what this means. But, fortunately, is a rarely appearing
> message.
> > Next, in my application I had defined a vtkOrientationMarkerWidget, but
> either
> > I've done something wrong or there is something wrong in the interactor
> (the
> > first is the MOST probable...), the vtkOrientationMarkerWidget does not
> follow
> > the interactor. It is frozen. I've tried some modification, but it seems to
> me
> > that the vtkOrientationMarkerWidget does not react to the mouse movements.
> > This is the last part of my code:
>
> Please send a sample that I can actually run.  Your code looks alright,
> but there's nothing like being able to test it.
>
>
> > As a last thing, Charl mentioned that:
> >
> > "In addition, a SetSize() call should be made on the FRAME to make sure
> that it
> > gets an OnPaint event when it's shown."
> >
> > I would say (based on the example in wxVTKRenderWindowInteractor), that:
> >
> > "In addition, a SetSize() call should be made on the WIDGET to make sure
> that it
> > gets an OnPaint event when it's shown."
>
> Strange... the sample (as it is now) was tested on XP and Debian, it
> should be fine.  SetSize() on the frame leads to (eventually) an OnPaint
> being invoked on the RWI, which is what we want.
>
> > I've tried a SetSize() on the frame but I get a runtime error with
> Python...
> > Charl, you found this little "bug" on XP, but I think that it is the same
> on
> > Win2000, because I am on a Win2000 machine... Probably I am doing (again)
> > something wrong...
>
> Does the NEW wxVTKRWI sample (that I also posted) also generate this error?
>
>
> --
> charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/
>






More information about the vtkusers mailing list