You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Double-click events are not recognised in Jupyter notebook #18404
Using the first example from the events documentation detects double-click events properly in the Qt backend, but when used in a Jupyter notebook, the two clicks are recognised as two separate single click events.
Code for reproduction
I've adapted the code to show the contents of the event as the figure title instead of a print statement, because the output of print statements inside functions triggered by events disappear in Jupyter notebooks.
The title always says single-click, no matter how fast I do my double-clicking.
The double click events are properly captured when using the standard Qt window renderer.
I have tried both the default %matplotlib notebook backend and the ipympl widget backend, and they show identical behaviour.
Labeled as good first issue as the changes should be relatively localized (as it only related to how we pass mouse events from the js frontend back to the Python side), but medium difficulty as it will require understanding some of the internals of our event system (to fabricate the correct Event on the python side), the protocol we use between the front end and the python process, and working in both Python and JS.
I think each of these task is well contained and tractable for someone who is comfortable working in both js and python.
Ipympl has a different javascript setup than nbagg so this will also need to be fixed there. I opened matplotlib/ipympl#261 with a quote of the original post in this issue.
I've adapted the code to show the contents of the event as the figure title instead of a print statement, because the output of print statements inside functions triggered by events disappear in Jupyter notebooks.
In jupyterlab you can see them by opening the Log Console and setting the level to info:
and then you can see the events in the log console:
You can also use an ipywidgets.Output to capture the output and display it.
Activity
tacaswell commentedon Sep 5, 2020
In the desktop backends we rely on the framework to detect the double click, hopefully this fix is as simple as getting the js to do the same for us.
tacaswell commentedon Sep 5, 2020
Labeled as good first issue as the changes should be relatively localized (as it only related to how we pass mouse events from the js frontend back to the Python side), but medium difficulty as it will require understanding some of the internals of our event system (to fabricate the correct Event on the python side), the protocol we use between the front end and the python process, and working in both Python and JS.
I think each of these task is well contained and tractable for someone who is comfortable working in both js and python.
ianhi commentedon Sep 6, 2020
Ipympl has a different javascript setup than nbagg so this will also need to be fixed there. I opened matplotlib/ipympl#261 with a quote of the original post in this issue.
In jupyterlab you can see them by opening the Log Console and setting the level to


info:and then you can see the events in the log console:
You can also use an
ipywidgets.Outputto capture the output and display it.nvaytet commentedon Sep 7, 2020
@ianhi nice! I didn't know about the Log Console trick.
Another workaround is to use
os.write, as I suggested in this other issue: jupyter/notebook#244 (comment)tacaswell commentedon Sep 7, 2020
@hershd23 It is "up for grabs" until someone starts working on it.