AaronWatters / jp_doodle

Tools for drawing 2d and 3d interactive visualizations using Jupyter proxy widgets
BSD 2-Clause "Simplified" License
53 stars 6 forks source link

keyboard shortcut for snapshot #5

Open AaronWatters opened 6 years ago

AaronWatters commented 6 years ago

copied from jupyter google group:

Interesting..

So the idea is that you can build an interactive in the first tab/canvas panel, then grab a snapshot of it that appears in the second?

If there is an interactive where the view is dependent on the mouse cursor position, eg in the Simple Python Example notebook, the image color sampling demo, is there a keybord short cut to click the Take snapshot button? (else how do you get to click the button without moving the mouse cursor away from the point you want to sample/snapshot?)

Is there any way of getting the snapshot into a variable (eg _ ) with a corresponding image data URI value?

--tony (hirst)

AaronWatters commented 6 years ago

reply by me in newgroup for reference:

Thanks Tony,

These are good suggestions. I added them as an issue to the jp_doodle repository https://github.com/AaronWatters/jp_doodle/issues/5 . I think I'll have to add some new API functionality to make a meta-keystroke workable for dual canvases because right now there is no way to attach a handler to a single key -- you have to attach a handler to all possible keystrokes -- so a meta-keystroke would either override or get overridden by any other keystroke handler for the specific visualization.

It's easy to attach a "last snapshot data" slot to the widget implementation, however.

Thanks for the feedback! -- Aaron Watters

psychemedia commented 6 years ago

@AaronWatters Thanks for adding that here.

The big issue I had with the image color sampling demo was that I could only grab a snapshot with with sampled colours from wherever the cursor left the grid on its traverse to the button to grab the snapshot? i.e. there was no way I could see to click the button other than with the mouse cursor, and no way to 'cursor.up' once I had selected a pixel in the middle of the grid?