I have an SVG image which I’m displaying within a jupyterlab notebook:
d = ipywidgets.Output()
I’d like to get callbacks when the image is clicked on, to let me change the contents of other widgets in response. The ipywidgets.Output() widget does have an observe() method, but my handler doesn’t get called. I think observe() on an Output widget doesn’t do what I’m trying to achieve.
Is there a way to do this?
Is there an alternate way to put an image in a Jupyterlab notebook which would be easier to implement callbacks from clicking on the image?
https://github.com/mwcraig/ipyevents looks like it can provide the offsets when an SVG is clicked on. For my particular case I could traverse the XML nodes from the SVG to determine which one contains the given coordinates.
ipyevent does not generate anything for ipywidgets.Output(), which is how I am handling the SVG image.
observe on an output widget tells you when the output widget state changes. It doesn’t tell you when you’ve clicked on an element.
I would have also suggested looking at ipyevents. I’m not sure why it doesn’t work with output widgets. Could you maybe file an issue in ipyevents with a small reproducible test case?