Hello!
I am trying to use vtkTextWidget
such that a user can drag it to a desired location. I have a python code that adds the widget - I can resize it, but not move it. Below is a minimal (non)working example showing what I am doing.
#!/usr/bin/env python
import vtk
def main():
text_actor = vtk.vtkTextActor()
text_actor.SetInput("Text")
text_property = text_actor.GetTextProperty()
text_property.SetColor([1, 1, 1])
text_property.SetBold(False)
text_property.SetItalic(False)
text_property.SetFontSize(40)
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
iren.SetRenderWindow(renWin)
renWin.SetSize(500, 500)
iren.Initialize()
renWin.Render()
widget = vtk.vtkTextWidget()
widget.SetInteractor(iren)
widget.SetTextActor(text_actor)
widget.On()
iren.Start()
if __name__ == '__main__':
main()
I am using vtk 9.0.3 on Mac OS X 12.0.1 with python 3.8.5.
With regards,
David