Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard support #6

Open
niedakh opened this issue Oct 10, 2019 · 1 comment
Open

Keyboard support #6

niedakh opened this issue Oct 10, 2019 · 1 comment

Comments

@niedakh
Copy link

niedakh commented Oct 10, 2019

Hi,

would you mind adding keyword shortcut support for options?

@cloudsforest
Copy link

Hi,

would you mind adding keyword shortcut support for options?

you can use @mwcraig 's https://github.com/mwcraig/ipyevents to add hotkey function to that.
please refer to the short sample (https://github.com/mwcraig/ipyevents/blob/master/doc/Widget%20DOM%20Events.ipynb) and change the handle_event function to the following:
def handle_event(event):
lines = ['{}: {}'.format(k, v) for k, v in event.items()]
#key input value
content = lines[7].split(':')[1]
h.value = content
if h.value.strip() == '0':
add_annotation(options[0])
elif h.value.strip() == '1':
add_annotation(options[1])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants