The problem is that the call to getch
is not blocking, so the program is constantly cycling through the while
loop. From the getch
documentation:
Get a character. Note that the integer returned does not have to be in ASCII range: function keys, keypad keys and so on return numbers higher than 256. In no-delay mode, -1 is returned if there is no input, else getch() waits until a key is pressed.
Your program sets nodelay
prior to the loop:
self.screen.nodelay(1)