[KWWidgets] newbie question: SetCommand

W. John neojohn75 at yahoo.com
Tue May 8 15:56:54 EDT 2007


Hello,
  I have a simple question about KWWidgets and Python.  I'm converting some code from TCL to Python and I'm having the following problems with the SetCommand function: 

  When calling slice_scale.SetCommand(image_viewer, "SetSlice") I get:
vtkTemp20 SetSlice 0
    Returned Error on line 1: 
invalid command name "vtkTemp20"

  In my Tcl program everything works fine...  This is what I have in Python.

    image_viewer = vtkImageViewer2()
    image_viewer.SetRenderWindow(render_widget.GetRenderWindow())
    image_viewer.SetRenderer(render_widget.GetRenderer())
    image_viewer.SetInput(reader.GetOutput())
    image_viewer.SetupInteractor(
       render_widget.GetRenderWindow().GetInteractor())
    image_viewer.SetColorWindow(range[1] - range[0])
    image_viewer.SetColorLevel(0.5 * (range[1] + range[0]))

    slice_scale = vtkKWScale()
    slice_scale.SetParent(parent)
    slice_scale.Create()
    slice_scale.SetRange(
             image_viewer.GetSliceMin(), image_viewer.GetSliceMax())
    slice_scale.SetResolution(1.0)
    slice_scale.SetLabelText("Slice")
    slice_scale.SetCommand(image_viewer, "SetSlice")
    app.Script("pack %s -side top -expand n -fill x", slice_scale.GetWidgetName())

Any idea what's wrong with my code?  What does the error " vtkTemp20 SetSlice 0" means?

Thanks!
-John

       
---------------------------------
Ahhh...imagining that irresistible "new car" smell?
 Check outnew cars at Yahoo! Autos.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/kwwidgets/attachments/20070508/be2b63bc/attachment.htm


More information about the KWWidgets mailing list