]> git.armaanb.net Git - lightcards.git/commitdiff
Clean up code
authorArmaan Bhojwani <me@armaanb.net>
Sun, 31 Jan 2021 14:10:10 +0000 (09:10 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Sun, 31 Jan 2021 14:10:10 +0000 (09:10 -0500)
lightcards/display.py

index 84f3d575afdafce4b73b4a97e246217d32ae078a..0ce321fcb1727105bd865b5d5f9ac8a1517b7f6b 100755 (executable)
@@ -3,6 +3,7 @@
 
 import curses
 from random import shuffle
+import sys
 
 
 def disp_bar(stdscr, stack, headers, obj):
@@ -29,6 +30,7 @@ def disp_bar(stdscr, stack, headers, obj):
 
 
 def disp_menu(stdscr, stack, headers, idx):
+    stdscr.clear()
     curses.init_pair(1, curses.COLOR_CYAN, 0)
     curses.init_pair(2, curses.COLOR_RED, 0)
     stdscr.addstr("Good job, you've completed a round!\n\n",
@@ -42,7 +44,7 @@ def disp_menu(stdscr, stack, headers, idx):
     while True:
         key = stdscr.getkey()
         if key == "q":
-            exit(0)
+            sys.exit(0)
         elif key == "r":
             idx.setIdx(0)
             get_key(stdscr, stack, headers, idx)
@@ -101,7 +103,7 @@ def get_key(stdscr, stack, headers, idx):
     while True:
         key = stdscr.getkey()
         if key == "q":
-            exit(0)
+            sys.exit(0)
         elif key in ["l", "KEY_LEFT"]:
             idx.forward(stack)
             idx.setSide(0)