當前位置: 首頁>>代碼示例>>Python>>正文


Python scene.SceneCanvas方法代碼示例

本文整理匯總了Python中vispy.scene.SceneCanvas方法的典型用法代碼示例。如果您正苦於以下問題:Python scene.SceneCanvas方法的具體用法?Python scene.SceneCanvas怎麽用?Python scene.SceneCanvas使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在vispy.scene的用法示例。


在下文中一共展示了scene.SceneCanvas方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: sheet_view

# 需要導入模塊: from vispy import scene [as 別名]
# 或者: from vispy.scene import SceneCanvas [as 別名]
def sheet_view(sheet, coords=None, interactive=True, **draw_specs_kw):
    """Uses VisPy to display an epithelium
    """
    draw_specs = sheet_spec()
    spec_updater(draw_specs, draw_specs_kw)

    if coords is None:
        coords = ["x", "y", "z"]
    canvas = scene.SceneCanvas(keys="interactive", show=True, size=(1240, 720))
    view = canvas.central_widget.add_view()
    view.camera = "turntable"
    view.camera.aspect = 1
    view.bgcolor = vp.color.Color("#222222")
    if draw_specs["edge"]["visible"]:
        wire = edge_visual(sheet, coords, **draw_specs["edge"])
        view.add(wire)
    if draw_specs["face"]["visible"]:
        mesh = face_visual(sheet, coords, **draw_specs["face"])
        view.add(mesh)

    canvas.show()
    view.camera.set_range()
    if interactive:
        app.run()
    return canvas, view 
開發者ID:DamCB,項目名稱:tyssue,代碼行數:27,代碼來源:vispy_draw.py

示例2: __init__

# 需要導入模塊: from vispy import scene [as 別名]
# 或者: from vispy.scene import SceneCanvas [as 別名]
def __init__(self):
        self.canvas = scene.SceneCanvas(keys='interactive', size=(800, 600),
                                        show=True)
        view = self.canvas.central_widget.add_view()
        view.bgcolor = '#ffffff'
        view.camera = TurntableCamera(fov=10.0, distance=40.0, up='+z',
                                      center=(0.0, 0.0, 1.0))
        XYZAxis(parent=view.scene)
        self.scene = view.scene 
開發者ID:bitcraze,項目名稱:crazyflie-lib-python,代碼行數:11,代碼來源:bezier_trajectory.py

示例3: __init__

# 需要導入模塊: from vispy import scene [as 別名]
# 或者: from vispy.scene import SceneCanvas [as 別名]
def __init__(self, keyupdateCB):
        scene.SceneCanvas.__init__(self, keys=None)
        self.size = 800, 600
        self.unfreeze()
        self.view = self.central_widget.add_view()
        self.view.bgcolor = '#ffffff'
        self.view.camera = TurntableCamera(
            fov=10.0, distance=30.0, up='+z', center=(0.0, 0.0, 0.0))
        self.last_pos = [0, 0, 0]
        self.pos_markers = visuals.Markers()
        self.meas_markers = visuals.Markers()
        self.pos_data = np.array([0, 0, 0], ndmin=2)
        self.meas_data = np.array([0, 0, 0], ndmin=2)
        self.lines = []

        self.view.add(self.pos_markers)
        self.view.add(self.meas_markers)
        for i in range(6):
            line = visuals.Line()
            self.lines.append(line)
            self.view.add(line)

        self.keyCB = keyupdateCB

        self.freeze()

        scene.visuals.XYZAxis(parent=self.view.scene) 
開發者ID:bitcraze,項目名稱:crazyflie-lib-python,代碼行數:29,代碼來源:multiranger_pointcloud.py

示例4: __init__

# 需要導入模塊: from vispy import scene [as 別名]
# 或者: from vispy.scene import SceneCanvas [as 別名]
def __init__(self):
        self.canvas = scene.SceneCanvas(
            keys='interactive', size=(1024, 768), show=True, config=dict(samples=4), resizable=True
        )

        self.plane_color = 0.25 * np.ones((1, 3))
        self.bg_color = 0.9 * np.ones((1, 3))
        self.line_color = 0.7 * np.ones((1, 3))

        # Set up a viewbox to display the cube with interactive arcball
        self.view = self.canvas.central_widget.add_view()
        self.view.bgcolor = self.bg_color
        self.view.camera = TurntableCamera(
            fov=30.0, elevation=30.0, azimuth=90.0, center=(0.0, 0.0, 1.25)
        )
        self.cam_state = self.view.camera.get_state()

        # add a colored 3D axis for orientation
        axis = scene.visuals.XYZAxis(parent=self.view.scene)
        self.cfs = []
        self.led_color_cache = []

        ground = scene.visuals.Plane(
            32.0, 32.0, direction="+z", color=self.plane_color, parent=self.view.scene
        )

        # Lazy-constructed vispy objects and data for connectivity graph gfx.
        self.graph_edges = None
        self.graph_lines = None
        self.graph = None

        # Lazy-constructed vispy objects for collision ellipsoids.
        self.ellipsoids = None
        self.ellipsoid_radii = None 
開發者ID:USC-ACTLab,項目名稱:crazyswarm,代碼行數:36,代碼來源:visVispy.py

示例5: test_3d_axis_visual

# 需要導入模塊: from vispy import scene [as 別名]
# 或者: from vispy.scene import SceneCanvas [as 別名]
def test_3d_axis_visual():

    canvas = scene.SceneCanvas(keys=None, size=(800, 600), show=True)
    view = canvas.central_widget.add_view()
    scene_transform = scene.STTransform()
    view.camera = scene.cameras.TurntableCamera(parent=view.scene,
                                                fov=0., distance=4.0)
    AxesVisual3D(view=view, axis_color='red', transform=scene_transform)

    canvas.native.show()
    canvas.native.close() 
開發者ID:glue-viz,項目名稱:glue-vispy-viewers,代碼行數:13,代碼來源:test_3d_axis_visual.py

示例6: __init__

# 需要導入模塊: from vispy import scene [as 別名]
# 或者: from vispy.scene import SceneCanvas [as 別名]
def __init__(self, config=None):

        scene.SceneCanvas.__init__(self, keys=None, config=config)
        self.unfreeze()

        back_color = str(QPalette().color(QPalette.Window).name())

        self.central_widget.bgcolor = back_color
        self.central_widget.border_color = back_color

        grid = self.central_widget.add_grid(margin=10)
        grid.spacing = 0

        top_padding = grid.add_widget(row=0, col=0, col_span=2)
        top_padding.height_max = 24

        yaxis = scene.AxisWidget(orientation='left', axis_color='black', text_color='black', font_size=12)
        yaxis.width_max = 60
        grid.add_widget(yaxis, row=1, col=0)

        xaxis = scene.AxisWidget(orientation='bottom', axis_color='black', text_color='black', font_size=12)
        xaxis.height_max = 40
        grid.add_widget(xaxis, row=2, col=1)

        right_padding = grid.add_widget(row=0, col=2, row_span=2)
        right_padding.width_max = 24

        view = grid.add_view(row=1, col=1, border_color='black', bgcolor='white')
        view.camera = Camera(aspect=1)

        # Following function was removed from 'prepare_draw()' of 'Grid' class by patch,
        # it is necessary to call manually
        grid._update_child_widget_dim()

        grid1 = scene.GridLines(parent=view.scene, color='gray')
        grid1.set_gl_state(depth_test=False)

        xaxis.link_view(view)
        yaxis.link_view(view)

        self.grid = grid1
        self.view = view
        self.freeze()

        self.measure_fps() 
開發者ID:Denvi,項目名稱:FlatCAM,代碼行數:47,代碼來源:VisPyCanvas.py

示例7: __init__

# 需要導入模塊: from vispy import scene [as 別名]
# 或者: from vispy.scene import SceneCanvas [as 別名]
def __init__(self, parent=None, viewer_state=None):

        # Prepare Vispy canvas. We set the depth_size to 24 to avoid issues
        # with isosurfaces on MacOS X
        self.canvas = scene.SceneCanvas(keys=None, show=False,
                                        config={'depth_size': 24},
                                        bgcolor=rgb(settings.BACKGROUND_COLOR))

        # Set up a viewbox
        self.view = self.canvas.central_widget.add_view()
        self.view.parent = self.canvas.scene

        # Set whether we are emulating a 3D texture. This needs to be enabled
        # as a workaround on Windows otherwise VisPy crashes.
        self.emulate_texture = (sys.platform == 'win32' and
                                sys.version_info[0] < 3)

        self.scene_transform = scene.STTransform()
        self.limit_transforms = {}

        fc = rgb(settings.FOREGROUND_COLOR)

        self.axis = AxesVisual3D(axis_color=fc, tick_color=fc, text_color=fc,
                                 tick_width=1, minor_tick_length=2,
                                 major_tick_length=4, axis_width=0,
                                 tick_label_margin=10, axis_label_margin=25,
                                 tick_font_size=6, axis_font_size=8,
                                 view=self.view,
                                 transform=self.scene_transform)

        # Create a turntable camera. For now, this is the only camerate type
        # we support, but if we support more in future, we should implement
        # that here

        # Orthographic perspective view as default
        self.view.camera = scene.cameras.TurntableCamera(parent=self.view.scene,
                                                         fov=0., distance=4.0)

        # We need to call render here otherwise we'll later encounter an OpenGL
        # program validation error.
        # self.canvas.render()

        self.viewer_state = viewer_state
        try:
            self.viewer_state.add_callback('*', self._update_from_state, as_kwargs=True)
        except TypeError:  # glue-core >= 0.11
            self.viewer_state.add_global_callback(self._update_from_state)
        self._update_from_state(force=True) 
開發者ID:glue-viz,項目名稱:glue-vispy-viewers,代碼行數:50,代碼來源:vispy_widget.py


注:本文中的vispy.scene.SceneCanvas方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。