Commit efdf4ac5 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Disable key listening to get rid of pynput dependency

parent 4af667da
...@@ -17,17 +17,6 @@ from strategy import State ...@@ -17,17 +17,6 @@ from strategy import State
MAX_SPEED_ROWS = 3 MAX_SPEED_ROWS = 3
def save_screenshot(win):
board = screenshot_board(win).convert('RGB')
os.makedirs('screens', exist_ok=True)
for i in count(1):
path = 'screens/board%d.png' % i
if not os.path.exists(path):
print('save screenshot in', path)
board.save(path)
break
if __name__ == '__main__': if __name__ == '__main__':
verbose = '-q' not in sys.argv[1:] verbose = '-q' not in sys.argv[1:]
...@@ -35,8 +24,6 @@ if __name__ == '__main__': ...@@ -35,8 +24,6 @@ if __name__ == '__main__':
win = get_exapunks_window() win = get_exapunks_window()
focus_window(win) focus_window(win)
listen_keys({'s': lambda: save_screenshot(win)})
buf = deque([], maxlen=3) buf = deque([], maxlen=3)
def vprint(*args, **kwargs): def vprint(*args, **kwargs):
......
...@@ -71,15 +71,8 @@ def press_keys(window, keys): ...@@ -71,15 +71,8 @@ def press_keys(window, keys):
time.sleep(KEY_DELAY / 1000) time.sleep(KEY_DELAY / 1000)
def listen_keys(handlers):
from pynput import keyboard
def handler(keycode):
key = str(keycode).replace('\'', '')
if key in handlers:
handlers[key]()
keyboard.Listener(on_release=handler).start()
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment