ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

Question: Bind key-press (hotkey) to activate widget event

Open kopperud opened this issue 6 years ago • 5 comments

Hello, I have a question. Let's say I create a simple widget in Jupyter, like the button from the documentation.

from IPython.display import display
button = widgets.Button(description="Click Me!")
display(button)

def on_button_clicked(b):
    print("Button clicked.")

button.on_click(on_button_clicked)

Now, I want this button to activate whenever I press a certain hotkey on the keyboard, let's say one of the arrow keys. Is there any possibility of doing this? If not, are there any alternative approaches? Packages or documentation I have missed?

Best regards, Bjørn

kopperud avatar Jan 18 '19 14:01 kopperud