ImperialCollegeLondon / ImperialCollegeLondon/python-guis

Using keyboard events with ipywidgets

Open
#11 0 comments 0 reactions 0 assignees View on GitHub
documentation
Dominant language
Python
Stars
9
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Matplotlib provides a "key_press_event" handler (analogous to "button_press_event") that is the standard approach to handling a key press with plots. Unfortunately this mechanism doesn't work very well within a notebook.

Instead we recommend use of [ipyevents](https://github.com/mwcraig/ipyevents) (you will need to install this yourself, remember to restart the jupyter server afterwards). A notebook linked from the ipyevents README shows a simple example that can be adapted for use. There is one trick needed, the output widget containing the plot must be placed within it's own VBox widget, with this used as the source for the ipyevents.Event widget.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by checking the repository's existing notebook and documentation structure, then compare it with the linked ipyevents README example. Confirm how the output widget is placed in a VBox and how the Event widget is configured; done means the keyboard-event guidance is documented in the appropriate project location.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.