本文整理汇总了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
示例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
示例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)
示例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
示例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()
示例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()
示例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)