I got to this point so far:
Christophs-MBP:vispy kuku$ jupyter nbextension enable vispy --py --sys-prefix Enabling notebook extension vispy/extension... - Validating: problems found: - require? X vispy/extension Christophs-MBP:vispy kuku$
Is there some vispy test I can run in jupyter notebook for verification?
--no-use-pep517has been removed in recent versions of pip (@kmuehlbauer may know more), we'll have to update the instructions with this new version. Otherwise, the
_jupyter_nbextension_paths()error is unexpected but jupyter widgets do evolve pretty quickly so it's possible we're missing something from recent updates.
If I run the rotating cube example in the examples/ipynb/RotatingCube.ipynb, nothing happens.
I also ran >>>vispy.test()
that gave a couple of errors, although most of all the 179 examples ran through. I could post the log here if it is of any interest. I have it still in the paste buffer and could drop it in here :)
vispy@latestif you are running from a directory with a
vispydirectory in it. So your workaround makes sense
import numpy as np
from vispy import app, scene
def init(self, args, **kwargs):
scene.visuals.InfiniteLine.init(self, args, **kwargs)
self.is_selected = False
self.last_position = np.inf
def on_draw(self, event): scene.visuals.InfiniteLineLine.draw(self) def on_mouse_press(self, pos_scene): if(abs(pos_scene - self.last_position) >= 1): self.set_data(pos = round(pos_scene), color=self.color) self.is_selected = True self.last_position = round(pos_scene) def on_mouse_release(self, event): print("release") self.is_selected = False def on_mouse_move(self, pos_scene): if(self.is_selected == True and abs(pos_scene - self.last_position) >= 1): self.set_data(pos = round(pos_scene), color=self.color) self.last_position = round(pos_scene) print(round(pos_scene))
""" A simple test canvas for testing the EditLineVisual """
def __init__(self): scene.SceneCanvas.__init__(self, keys='interactive', size=(800, 800)) self.unfreeze() self.view = self.central_widget.add_view() self.view.camera = scene.PanZoomCamera(rect=(-100, -100, 200, 200), aspect=1.0) self.view.camera._viewbox.events.mouse_move.disconnect( self.view.camera.viewbox_mouse_event) self.line = EditLineVisual(pos=5.0, color=[1.0, 1.0, 0.5, 0.5], vertical=True, parent = self.view.scene) self.show() self.selected_point = None self.freeze() def on_mouse_press(self, event): tr = self.scene.node_transform(self.line) pos = tr.map(event.pos) self.line.on_mouse_press(pos) def on_mouse_move(self, event): tr = self.scene.node_transform(self.line) pos = tr.map(event.pos) self.line.on_mouse_move(pos) def on_mouse_release(self, event): self.line.on_mouse_release(event)
if name == 'main':
win = Canvas()
on_mouse_press. Normally you would let the camera handle these events and do what it needs to do. I would recommend commenting out your
on_mouse_Xmethods and see what happens.
Are there any projects using vispy with huge 2D images (say 100's of GB) where you can pan/zoom around like on google maps?
We use vispy for https://github.com/napari/napari and we have a synchronous version for "multiscale images". On disk the images are in Zarr format, or any similar type of chunked storage.
It's decent but it will hitch/pause as tiles load. We are looking at doing an asynch version. So always 60Hz and tiles load in the background. Has anyone done anything like this on top of vispy? Thanks.
@pmendoncaphysics Hard to say without knowing what the errors were :wink:
Usually though in spyder you'll have to explicitly say what backend you want to use. Otherwise, vispy's default will mistakenly think it is running in a notebook and use the webgl backend when it shouldn't.