[vtkusers] vtkDistanceWidget label visibility
Rafal Makowka
rafal.makowka at histoscanning.com
Wed Feb 27 10:10:21 EST 2013
Hi,
I would like to control visibility of the distance widget label.
I use vtkDistanceRepresentation3D and GetLabelActor method.
Unfortunately it doesn't work as I expected.
Label is always visible, even Visibility of the label actor is equal 0.
Code in python:
<code>
import vtk
import random
import sys
import math
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)
interactor = vtk.vtkRenderWindowInteractor()
interactor.SetRenderWindow(renderWindow)
renderer.SetBackground(0.1, 0.2, 0.4)
renderWindow.SetSize(600, 600)
distanceWidget = vtk.vtkDistanceWidget();
distanceWidget.SetInteractor(interactor);
distanceWidget.CreateDefaultRepresentation()
distanceRep = vtk.vtkDistanceRepresentation3D()
distanceWidget.SetRepresentation(distanceRep)
distanceWidget.On();
def LeftMouseButton(obj, ev):
label = distanceRep.GetLabelActor()
label.SetVisibility(1)
print label.GetVisibility()
def RightMouseButton(obj, ev):
label = distanceRep.GetLabelActor()
label.SetVisibility(0)
print label.GetVisibility()
renderer.ResetCamera()
renderWindow.Render()
interactor.AddObserver('LeftButtonPressEvent', LeftMouseButton, 1.0)
interactor.AddObserver('RightButtonPressEvent', RightMouseButton, 1.0)
interactor.Initialize()
interactor.Start()
</code>
Thanks in advance!
Rafal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130227/e558e8d1/attachment.htm>
More information about the vtkusers
mailing list