[vtkusers] Pls help! tk gui window disappears when i start the vtkRenderWindowInteractor

john jss at mensa.org.au
Mon Mar 13 01:02:59 EDT 2017


Thanks David!

your tip re vtkRenderWidget and that MaceTk.tcl was enough to get me on
the path to success. I canned the vtkRenderWindowInteractor, and then
used just the vtkTkRenderWidget, creating another top level window for
it. Now my little script is working just as I vaguely recall it used to
(last time i did anything with this was back in about 2003). I have a
little window with some controls, and a separate window for the rendered
image, which i can rotate & zoom.

In case it helps anyone in future, the extra snippet of code i needed
was this (which creates the new window using the renWin renderer i
created earlier):


#Create a separate window for the rendered image:
toplevel .renderwindow
wm title .renderwindow "3D PSE"

vtkTkRenderWidget .renderwindow.renwidget -width 600 -height 700 -rw renWin

pack .renderwindow.renwidget

# Setup Tk bindings and VTK observers for that widget.
::vtk::bind_tk_render_widget .renderwindow.renwidget



On Sun, 12 Mar 2017 20:58:35 -0600
David Gobbi <> wrote:

> Hi John,
> 
> Try running some of the Tcl gui examples to see if they work for you:
> http://www.vtk.org/gitweb?p=VTK.git;a=tree;f=Examples/GUI/Tcl
> 
> The MaceTk.tcl example uses the vtkTkRenderWidget and eliminates the
> vtkRenderWindowInteractor (since the vtkTkRenderWidget can handle
> interaction all by itself).  That might be the best approach.
> 
> Unfortunately it's been a long, long time since I've written a vtk tcl
> program so I can't give any specific advice on your code.
> 
> Regards,
>  - David
> 
> 
> On Sun, Mar 12, 2017 at 7:59 PM, john <> wrote:
> 
> > Hi good peoples,
> >
> > I'm wondering if someone can help me with an issue I'm seeing after
> > updating an old vtk/tcl script to work with new VTK.
> >
> > The updates i made were things like changing the image pipeline
> > filters to use SetInputConnection, instead of the deprecated old
> > SetInput, and other minor updates.
> >
> > Basically, after the updates, the script works fine except that if
> > when I add command to start the vtkRenderWindowInteractor, the
> > little TK gui I've built does not appear.
> >
> > If i leave out the command to start the vtkRenderWindowInteractor
> > (iren Start), then my tk gui appears, and I can use it to update
> > some parameters of the renderer, and the the gui has a Render button
> > which calls renWin Render to update the render window, and that's
> > all working fine. But in this state, the render window cannot be
> > interacted with. I can't zoom or rotate the view :-(
> >
> > Back when I had this working on VTK 4 or 5, I'm sure I had the TK
> > gui up, and working, while at the same time being able to interact
> > with the rendered window.
> >
> > I've tried with VTK 6.3 and 7.1, and behaviour is the same.
> >
> > I am basically a beginner with TCL/TK & VTK, so I've tried various
> > things but had no success. I'm sure I must be just missing something
> > relatively simple.
> >
> > I'd be happy with any solution that lets me use my tk gui, and the
> > rendered window, even if only one window is active at a time, eg, I
> > tried to get the "u" UserEvent of the vtkRenderWindowInteractor
> > mapped so it would bring up the tk gui, but i couldn't get that to
> > work. With most of the hacks i tried, the "u" button did nothing,
> > and when i did get it to do something, all it did was bring up some
> > blank windows called vtkInteract, which didn't seem to respond to
> > anything i did with it.
> >
> > If i could get a key mapped which would pause the
> > vtkRenderWindowInteractor and bring up my tk gui so i could make
> > adjustments in the gui, then click a button to re-activate the
> > vtkRenderWindowInteractor, that would be fine.
> >
> > If anyone can have a quick look at my script below, and tell me how
> > to get my TK gui working whilst also being able to have interaction
> > on the vtkRenderWindowInteractor working, that'd be awsm.
> >
> > Many thanks,
> > John
> >  
> 



More information about the vtkusers mailing list