Catching keyboard events in widgets... in Google Colab

pyannotebook is my first attempt at building a widget for audio annotation.

As I wanted to support keyboard shortcuts, I chose to go with ipyevents and… that works just fine in jupyter notebook.

However, I am now wondering whether it was a good choice because:

  • ipyevents does not seem to be maintained anymore;
  • it does not work in Google Colab (because they seem to catch key press before ipyevents does)

I prepared a notebook than can be tried directly in Google Colab to get an idea of what the problem is.

What is the recommended way of implementing keyboard shortcuts with ipywidgets today?



You probably want to seek help among the Google Colab community and maintainers. Google Colab is a highly customized much older fork of Jupyter Notebook.
If you want to use open source, current Jupyter community offerings, then that is a different matter and you should edit your title and post.

There are ways to share active notebooks via JupyterLite or MyBinder if that is your issue. These allow you to use the current tech in line with current ipywidgets development.

1 Like