當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。