jupyter-widgets-contrib / ipycanvas

Interactive Canvas in Jupyter
https://ipycanvas.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
688 stars 64 forks source link

Mouse events + key events #26

Open martinRenou opened 5 years ago

hagrid67 commented 3 years ago

Hi Martin, thanks for creating and maintaining this widget. I previously used the jupyter_canvas_widget by @Who8MyLunch. Sadly his repo stopped working with recent Jupyter versions and is now removed. It had mouse_click events and you could read key states. I'm trying to adapt my code from his to yours. Are you still hoping to add these additional events? Thanks!

martinRenou commented 3 years ago

Hey 😊

This is definitely still on the road map. Would you be able to give it a shot and try a PR? I would be happy to make a new release with it

hagrid67 commented 3 years ago

I'd give it a go but I'm not sure where to start with getting it to capture key events. I do have the old jupyter_canvas_widget code; and maybe @who8mylunch would help us:) I'll have a look and get back to you.

Caveat - I'm a JavaScript / typescript novice; I've done a couple of small projects using other libs and modding examples but I don't understand the architecture. (My python is strong enough.)

Who8MyLunch commented 3 years ago

Hi @hagrid67,

I've set my repo back to public in the hope that it might help you: https://github.com/Who8MyLunch/Jupyter_Canvas_Widget. I had set it private a while back since I couldn't keep up with changes in the Jupyter infrastructure.

The mouse event capture and processing takes place in both JavaScript https://github.com/Who8MyLunch/Jupyter_Canvas_Widget/blob/master/js/lib/jupyter-canvas.js and Python https://github.com/Who8MyLunch/Jupyter_Canvas_Widget/blob/master/jpy_canvas/canvas.py.

I'll leave that repo public from now on, but I have no plans to develop it further.

hagrid67 commented 3 years ago

Hi thanks Pierre @who8mylunch. It would be great if we can get some of your functionality going again. I should say that I gained some personal kudos within our project from the graphical editor I created with it. Thanks again.

Who8MyLunch commented 3 years ago

@hagrid67 that project is awesome! Very nice!

Its been a long time since I've even looked at my Jupyter Canvas Widget project. If you have specific changes or updates in mind I'd be happy to accept some pull requests. Do you have notes on what is broken?

martinRenou commented 3 years ago

Maybe this discussion could continue on in the jupyter_canvas_widget repo?