summaryrefslogtreecommitdiff
path: root/tui
diff options
context:
space:
mode:
authorAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-13 16:54:56 +0200
committerAineopintojen-harjoitustyo-Algoritmit-j <github-hy-tiralabra@v.hix.fi>2024-01-13 16:54:56 +0200
commit9f7086628c58392b7bdc45f9f0994bfbd64b99c6 (patch)
treeae8d4157fc13e6144803ab637e4f965d882492c6 /tui
parent39b556941b386687c7819df458772a32a96b44e4 (diff)
Fixing 100% CPU usage on constant stdin polling by sleeping a bit.
Diffstat (limited to 'tui')
-rw-r--r--tui/tui.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tui/tui.py b/tui/tui.py
index d8c6a5d..1262825 100644
--- a/tui/tui.py
+++ b/tui/tui.py
@@ -1,4 +1,5 @@
import termios, fcntl, sys, os
+from time import sleep
from tui.static import Action, ActionKeys, ActionEscKeys, Colors, TileTypes
class Tui():
@@ -64,6 +65,8 @@ class Tui():
escape = 0
while True:
try:
+ # Ehkä riittää jos näppäimiä luetaan 200x sekunnissa
+ sleep(0.005)
c = sys.stdin.read(1)
except:
continue