Linking keypress in page to a python callback

Thanks, but that seems unrelated. I need a hook that links the keyboard press in the dashboard tab in the browser.