where I can get simple examples of Wx including VTK viewer

Hi,

I am learning to implement VTK (viewer) into Wx frame, I want to read data and see the surface mesh,
where I can find the simple examples online ? so I can start to learn and work on it.

many thanks and have nice weekend.
Xiaojian

Hi Xiaojian,

I am learning to implement VTK (viewer) into Wx frame, I want to read data
and see the surface mesh,
where I can find the simple examples online ? so I can start to learn and
work on it.

Python bindings for VTK come with a couple of examples inside
wxVTKRenderWindow.py and wxVTKRenderWindowInteractor.py. They are very
basic examples. If you need to do something more sophisticated, I
would suggest you to take a look at Mayavi 2 (which GUI is built using
wxPython). If you want to implement the drawings yourself, it might
take a bit of work and studying as VTK has a quite steep learning
curve. In any case, it's a wonderful tool to have for 3D plotting and
viewing, although I am still baffled on how to tune it for very big
datasets :frowning:

HTH.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 10/6/07, Xiaojian Wang wrote:

Andrea Gavana wrote:

Hi Xiaojian,

I am learning to implement VTK (viewer) into Wx frame, I want to read data
and see the surface mesh,
where I can find the simple examples online ? so I can start to learn and
work on it.

Python bindings for VTK come with a couple of examples inside
wxVTKRenderWindow.py and wxVTKRenderWindowInteractor.py. They are very
basic examples. If you need to do something more sophisticated, I

[...]

I thought that wxVTKRenderWindow does 'a little too much' to be used in
my project, because I wanted to handle mouse interactions etc. myself.

So I wrote a little helper class myself, which you can find here:

and a usage example there:

The intention was to create a class that can be used as a drop-in replacement for
the vtk.vtkRenderWindow class. Be careful, as it may still contain lots of bugs,
yet it works for me.

HTH,
Klaus

···

On 10/6/07, Xiaojian Wang wrote:

So I have a panel that needs to be created with certain data items
(static/text control). At the beginning of my app I add the blank panel to
my manager and hide the panel. Then based on a right-click event on a tree
item, I then Show() the panel, and have a global variable in the parent that
contains all of the relevant data.

The global variable passes the data along fine, but when I bind an EVT_SHOW
to actually paint the controls, it doesn't work. Then if I close the panel
and right click on another item and when it opens a second time it has the
set of controls from the first time and the new controls from the recent
click.

Any idea what I am doing wrong here? I tried a Refresh(), Update() and a
whole bunch of kludgy workarounds but nothing worked. Any help would be
appreciated :slight_smile:

JS

J.M. Seitz wrote:

So I have a panel that needs to be created with certain data items
(static/text control). At the beginning of my app I add the blank panel to
my manager and hide the panel. Then based on a right-click event on a tree
item, I then Show() the panel, and have a global variable in the parent that
contains all of the relevant data.

The global variable passes the data along fine, but when I bind an EVT_SHOW
to actually paint the controls, it doesn't work. Then if I close the panel
and right click on another item and when it opens a second time it has the
set of controls from the first time and the new controls from the recent
click.

Any idea what I am doing wrong here? I tried a Refresh(), Update() and a
whole bunch of kludgy workarounds but nothing worked. Any help would be
appreciated :slight_smile:

When you say "paint the controls" do you mean creating the widgets or are you actually drawing something on a DC? In either case the EVT_SHOW event is probably not the right place to do it. If you are painting stuff yourself then you need to be doing it in the EVT_PAINT. Otherwise you can create the widgets whenever you need to, you don't need to wait for the event. For example you can create the widgets when you create the panel, or just before you show it. For the second set of controls you will need to destroy the old widgets first. Or you can just create a new panel with its own set of controls, and destroy the old panel. It would probably also make sense to create separate classes derived from wx.Panel that encapsulate the various sets of controls you need. Then you can treat them each as a single entity.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!