小编Ame*_*mei的帖子

如何在 Vispy 3d 图中获取点的位置?

我是 VisPy 的初学者。

我想做的就是:

单击该点,该点将改变颜色并打印该点的位置 (x,y,z)。

但我找不到如何做到这一点。

这是我的代码。

import numpy as np
import sys
from vispy import app, visuals, scene

class Canvas(scene.SceneCanvas):
    """ A simple test canvas for testing the EditLineVisual """

    def __init__(self):
        scene.SceneCanvas.__init__(self, keys='interactive',
                                   size=(800, 800), show=True)

        # # Create some initial points
        self.unfreeze()
        # Add a ViewBox to let the user zoom/rotate
        self.view = self.central_widget.add_view()
        self.view.camera = 'turntable'
        self.view.camera.fov = 30
        self.show()
        self.selected_point = None
        scene.visuals.GridLines(parent=self.view.scene)
        self.freeze()

    def on_mouse_press(self, event):
        print(event.pos) # How to convert this pos …
Run Code Online (Sandbox Code Playgroud)

python 3d scatter vispy

4
推荐指数
1
解决办法
925
查看次数

标签 统计

3d ×1

python ×1

scatter ×1

vispy ×1