[vtkusers] [newbie] vtkImageViewerWidget.py & Tk scrollable canvas

Eric Boix frog at creatis.insa-lyon.fr
Wed Jan 17 12:43:47 EST 2001


        Hi,

Context: vtk Nightly (version circa 10th january 2001, build against
         tcl/tk 8.3.2), Python 1.5.2, linux 2.2.18, Xfree4.0.1,
         GeForce256 with Nvidia GLX.

For some obscure reason (to me!) I can't get the python version of
vtkTkImageViewerWidget to work within a "scrollable" TK canvas.
What happens is that the displayed portion of the canvas is always
the full size of my vtkTkImageViewerWidget (instead of the specified
subrectangle).

Suprisingly enough this works fine in Tcl (to be honest I'm translating
by hand some VTK/Tcl code to VTK/python).

As a working case (both python scripts described below can be found
in http://www.creatis.insa-lyon.fr/~frog/pythonvtkexample) I did the
following :

 1/ I took the canvas-with-scrollbars.py demo of python as found in
    Python-1.5.2/Demo/tkinter/matt/canvas-with-scrollbars.py.
    I expurgated it from unecessary widgets in order to obtain
     http://www.creatis.insa-lyon.fr/~frog/pythonvtkexample/canvas_with_scrollbars.py

 2/ I then took the vtkImageViewerWidget.py example of the vtk nigthly release
    (circa january 10th 2001) as found in the vtk/python subdirectory.
    I modified (really minor modifs) this example in order to obtain 
     http://www.creatis.insa-lyon.fr/~frog/pythonvtkexample/vtkImageViewerWidget_modified.py
    (basicaly I pluged in the scrolled canvas). Here is the result of the
     command "diff vtkImageViewerWidget.py vtkImageViewerWidget_modified.py"
     > from canvas_with_scrollbars import *
     315a317
     >     scrolled = Test(frame)
     317c319
     <  ren = vtkTkImageViewerWidget(frame,width=512,height=512,iv=viewer)
     ---
     >ren = vtkTkImageViewerWidget(scrolled.draw,width=512,height=512,iv=viewer)

 3/ I now launch (current working directory has to be vtk/python)
       python vtkImageViewerWidget_modified.py
    and get frustrated :-) with the fully displayed vtkImageCanvasSource2D
    instead of a scrollable subrectangle.

I would truly appreciate any kind of help...

   Yours,
   Eric Boix.

----
Eric.Boix at creatis.insa-lyon.fr
http://www.creatis.insa-lyon.fr/~frog
	




More information about the vtkusers mailing list