当前位置: 首页>>代码示例>>Python>>正文


Python vtk.vtkTextActor方法代码示例

本文整理汇总了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() 
开发者ID:pyCGNS,项目名称:pyCGNS,代码行数:26,代码来源:wvtk.py

示例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() 
开发者ID:pyCGNS,项目名称:pyCGNS,代码行数:33,代码来源:wvtk.py

示例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) 
开发者ID:cgre-aachen,项目名称:gempy,代码行数:16,代码来源:visualization_3d.py


注:本文中的vtk.vtkTextActor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。