def on_key_press(event):
    """ Manage keyboard shortcuts for canvas. """
    canvas = event.source
    viewer = canvas._wrapper
    if event.text.lower() == 'o':
        viewer.toggle_overlay()
    elif event.text.lower() == 'l':
        viewer.show_legend = viewer.show_legend is False
    elif event.text.lower() == 'd':
        viewer.selected = []
    elif event.text.lower() == 'q':
        viewer._cycle_neurons(-1)
    elif event.text.lower() == 'w':
        viewer._cycle_neurons(1)
    elif event.text.lower() == 'h':
        viewer.hide_selected()
    elif event.text.lower() == 'u':
        viewer.unhide_neurons(check_alpha=True)
    elif event.text.lower() == 'f':
        viewer._toggle_fps()
    elif event.text.lower() == 'p':
        viewer.toggle_picking()
    elif event.text.lower() == '1':
        viewer.set_view('XY')
    elif event.text.lower() == '2':
        viewer.set_view('XZ')
    elif event.text.lower() == '3':
        viewer.set_view('YZ')
