本文整理汇总了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)