I have a render window that contains a text actor .
its widget container can scale and resize by user but the text position is still fixed.(I used grid layout with pyqt5 that is resizable and contains my render windows.)
I set the text on left-center and also want to be on left-center when the parent widget size become bigger or smaller.
How can I do this and make the text position scalable for all sizes and remain at the same position?
This is my code below :
# Create Actor txtActor = vtk.vtkTextActor() txtActor.SetInput("L") # Set coordinates to match the old vtkScaledTextActor default value txtActor.GetPosition2Coordinate().SetCoordinateSystemToNormalizedViewport() txtActor.SetDisplayPosition(x, y) # Set Text Properties txtprop = txtActor.GetTextProperty() txtprop.SetFontFamilyToArial() txtprop.SetFontSize(50) txtprop.SetJustificationToCentered() txtprop.SetColor(1, .84, 0) renderer.AddActor2D(txtActor)
and The output is :
as you see in bigger size label “L” is not center any more.