From 2839995d7916b8d249f91bb2081b3e53f45d5269 Mon Sep 17 00:00:00 2001 From: adrienmalin <41926238+adrienmalin@users.noreply.github.com> Date: Thu, 7 Feb 2019 22:37:52 +0100 Subject: [PATCH] Update terminis.py --- terminis.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/terminis.py b/terminis.py index 0dca03a..65a2d4e 100644 --- a/terminis.py +++ b/terminis.py @@ -12,7 +12,9 @@ import random import sched import time - +# You can change controls here. +# Acceptable values are printable keys ('q', 'w'...) and curses's constants name starting with "KEY_" +# See https://docs.python.org/3/library/curses.html?highlight=curses#constants CONTROLS = { "MOVE LEFT": "KEY_LEFT", "MOVE RIGHT": "KEY_RIGHT", @@ -26,7 +28,6 @@ CONTROLS = { } - FILE = ".terminis" @@ -600,11 +601,11 @@ class Game: self.next.refresh(paused=True) self.scr.nodelay(False) while True: - key = self.scr.getch() - if key == ord('q'): + key = self.scr.getkey() + if key == CONTROLS["QUIT"]: self.playing = False break - elif key == ord('p'): + elif key == CONTROLS["PAUSE"]: self.scr.nodelay(True) self.hold.refresh() self.matrix.refresh() @@ -661,4 +662,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main()