前言
添加
from tvtk.tools import ivtk
時候,
若報錯
則
No module named Pygments
pip install Pygments
TVTK 管線
管線技術(Pipeline,流水線)
可視化管線(Visualization Pipeline):将原始資料加工成圖形資料的過程
圖形管線(Graphics Pipeline):圖形資料加工為我們所看到的圖像的過程
from tvtk.api import tvtk
from tvtk.tools import ivtk
from pyface.api import GUI
s = tvtk.CubeSource(x_length=1.0, y_length=2.0, z_length=3.0)
m = tvtk.PolyDataMapper(input_connection=s.output_port)
a = tvtk.Actor(mapper=m)
# 建立一個帶 Crust (Python Shell)視窗
gui = GUI()
win = ivtk.IVTKWithCrustAndBrowser()
win.open()
win.scene.add_actor(a)
# 修正錯誤
dialog = win.control.centralWidget().widget(0).widget(0)
from pyface.qt import QtCore
dialog.setWindowFlags(QtCore.Qt.WindowFlags(0x00000000))
dialog.show()
# 開始界面消息循環
gui.start_event_loop()