Esempio n. 1
0
    def _create_ivtk_window(self, size=(800, 800)):
        from enthought.tvtk.tools import ivtk
        from enthought.pyface.api import GUI

        # Create a GUI instance.
        self.gui = GUI()
        window = ivtk.IVTKWithCrustAndBrowser(size=size)  # Size is optional.
        # Open the window.
        window.open()
        self.renderer = window.scene
        self.render_window = window
Esempio n. 2
0
def show_actors(actors, shell=False):
    gui = GUI()
    if shell:
        window = ivtk.IVTKWithCrustAndBrowser(size=(800, 600))
    else:
        window = ivtk.IVTKWithBrowser(size=(600, 400))
    window.open()
    for a in actors:
        window.scene.add_actor(a)
    window.scene.background = (1, 1, 1)
    return window, gui
Esempio n. 3
0
def main():
    gui = GUI()
    # Create and open an application window.
    window = ivtk.IVTKWithCrustAndBrowser(size=(800, 600))
    window.open()
    f = Figure(window.scene)

    # Create an outline.
    o = Outline()
    f.add(o)

    # Create some pretty pictures.
    #test_lines(f)
    test_surf(f)

    window.scene.reset_zoom()

    # Start the GUI event loop!
    gui.start_event_loop()
Esempio n. 4
0
# -*- coding: utf-8 -*-
from enthought.tvtk.api import tvtk

# 载入ivtk所需要的对象
from enthought.tvtk.tools import ivtk
from enthought.pyface.api import GUI

cs = tvtk.ConeSource(height=3.0, radius=1.0, resolution=36)
m = tvtk.PolyDataMapper(input = cs.output)
a = tvtk.Actor(mapper=m)

# 创建一个GUI对象,和一个带Crust(Python shell)的ivtk窗口
gui = GUI()
window = ivtk.IVTKWithCrustAndBrowser(size=(800,600))
window.open()
window.scene.add_actor( a ) # 将圆锥的actor添加进窗口的场景中
gui.start_event_loop()
#window.scene.reset_zoom()
Esempio n. 5
0
from enthought.tvtk.tools import ivtk

# The actors module has a few helper functions that allow one to
# create simple shapes easily.  These functions return TVTK Actor
# instances.  We use it here for convenience.
from enthought.tvtk.pyface import actors

# Create a GUI instance.
gui = GUI()

# Create and open an IVTK application window that has an embedded TVTK
# pipeline browser and an interactive Python interpreter shell via
# PyCrust.  If you don't want all these you can choose between the
# following classes in ivtk -- IVTK, IVTKWithCrust, IVTKWithBrowser
# and IVTKWithCrustAndBrowser.
window = ivtk.IVTKWithCrustAndBrowser(size=(800, 600))  # Size is optional.

# Open the window.
window.open()


class EarthActor(HasTraits):
    position = Tuple

    def __init__(self):
        earth = actors.earth_actor()
        earth.property.color = actors.colors.green
        sphere = actors.sphere_actor(color=actors.colors.blue, opacity=0.65)
        self.earth, self.sphere = earth, sphere

    def _position_changed(self, val):
Esempio n. 6
0
 def _window_default(self):
     # Should experiment with passing in a pipeline browser
     # that has two root objects -- one for TVTKBases, i.e. the render
     # window, and one that accepts our objects
     return ivtk.IVTKWithCrustAndBrowser(size=(800, 600), stereo=1)