#!/usr/bin/env python3 # # Copyright (c) 2022 Kris Occhipinti https://filmsbykris.com. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 3. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # from pynput.keyboard import Key, Listener def pressed(key): print('\nKey Pressed {0}'.format( key)) if key == Key.esc: quit() with Listener(on_press = pressed) as listener: listener.join()