Python vtk.vtkTextActor() Examples
The following are 3
code examples of vtk.vtkTextActor().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
vtk
, or try the search function
.
Example #1
Source File: wvtk.py From pyCGNS with GNU Lesser General Public License v2.1 | 6 votes |
def addPicker(self): txtActor = vtk.vtkActor2D() self.txtMapper = vtk.vtkTextMapper() txtActor.SetMapper(self.txtMapper) self.textActor = vtk.vtkTextActor() self.textActor.VisibilityOff() self.textActor.PickableOff() tprop = vtk.vtkTextProperty() tprop.SetFontFamilyToArial() tprop.SetFontSize(10) tprop.BoldOff() tprop.ShadowOff() tprop.SetColor(self.color) self.textActor.SetTextProperty(tprop) self.picker = vtk.vtkCellPicker() self.picker.SetTolerance(0.001) self.picker.AddObserver("EndPickEvent", self.annotatePick) self.textrepresentation = vtk.vtkTextRepresentation() self.textrepresentation.GetPositionCoordinate().SetCoordinateSystem(3) self.textwidget = vtk.vtkTextWidget() self.textwidget.SetRepresentation(self.textrepresentation) self.textwidget.SetTextActor(self.textActor) self.textwidget.SelectableOff() self.textwidget.ResizableOff()
Example #2
Source File: wvtk.py From pyCGNS with GNU Lesser General Public License v2.1 | 5 votes |
def displayScalars(self, *args): self.setPickableOff() eventPos = self._iren.GetEventPosition() picker = vtk.vtkCellPicker() picker.Pick(eventPos[0], eventPos[1], 0.0, self._vtkren) cell = picker.GetCellId() if cell > -1: array = self.cVariables.currentIndex() - 1 grid = self._currentactor[1].GetMapper().GetInput() data = grid.GetCellData().GetArray(array) value = data.GetTuple1(cell) value = "%.3f" % value txt = vtk.vtkTextActor() txt.SetInput(value) txtprop = txt.GetTextProperty() txtprop.SetFontFamilyToArial() txtprop.SetFontSize(18) txtprop.SetColor(self.color) txt.SetDisplayPosition(eventPos[0], eventPos[1]) self.selectionCellId(grid, cell) self._vtkren.AddActor(txt) if self.txt is not None: self._vtkren.RemoveActor(self.txt) self._iren.Render() self.txt = txt else: if self.txt is not None: self._vtkren.RemoveActor(self.txt) self._vtkren.RemoveActor(self.actorpt) self._iren.Render() self.setPickableOn()
Example #3
Source File: visualization_3d.py From gempy with GNU Lesser General Public License v3.0 | 5 votes |
def set_text(self): txt = vtk.vtkTextActor() txt.SetInput("Press L to toggle layers visibility \n" "Press R to toggle real time updates \n" "Press H or P to go back to Python \n" "Press Q to quit") txtprop = txt.GetTextProperty() txtprop.SetFontFamilyToArial() txtprop.SetFontSize(18) txtprop.SetColor(1, 1, 1) txt.SetDisplayPosition(20, 60) # assign actor to the renderer self.ren_list[0].AddActor(txt)