本文整理匯總了Python中vtk.vtkTextActor方法的典型用法代碼示例。如果您正苦於以下問題:Python vtk.vtkTextActor方法的具體用法?Python vtk.vtkTextActor怎麽用?Python vtk.vtkTextActor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vtk
的用法示例。
在下文中一共展示了vtk.vtkTextActor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: addPicker
# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkTextActor [as 別名]
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()
示例2: displayScalars
# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkTextActor [as 別名]
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()
示例3: set_text
# 需要導入模塊: import vtk [as 別名]
# 或者: from vtk import vtkTextActor [as 別名]
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)