def _key_press(event, params):
    if event.key == 'left':
        params['pause'] = True
        params['frame'] = max(params['frame'] - 1, 0)
    elif event.key == 'right':
        params['pause'] = True
        params['frame'] = min(params['frame'] + 1, len(params['frames']) - 1)
Function for handling key presses for the animation.
dataset/ETHPy150Open mne-tools/mne-python/mne/viz/topomap.py/_key_press