new curses interface for testing

This commit is contained in:
luxick
2015-07-26 21:06:27 +02:00
parent 030d2c0669
commit 0c6e2cbdf2

24
test.py
View File

@@ -3,6 +3,7 @@
from mayorgotchi import Mayorgotchi from mayorgotchi import Mayorgotchi
from util import Util from util import Util
import time import time
import curses
# Temporary test section # Temporary test section
@@ -18,11 +19,24 @@ for n in range(0,50):
list.append(Util().make_Tamagotchi()) list.append(Util().make_Tamagotchi())
mayor = Mayorgotchi(list) mayor = Mayorgotchi(list)
screen = curses.initscr()
curses.noecho()
curses.curs_set(0)
screen.keypad(1)
screen.nodelay(1)
for n in range (0, ticks): for n in range (0, ticks):
screen.move(0,0)
mayor.step() mayor.step()
print(chr(27) + "[2J") screen.addstr('----------------------After '+str(n)+' ticks------------------------------\n')
print '----------------------After '+str(n)+' ticks------------------------------\n' screen.addstr(mayor.give_status(show_pct))
print mayor.give_status(show_pct) screen.clrtobot()
key = screen.getch()
time.sleep(0.5) if key == ord('q'):
break
elif key < 0:
time.sleep(0.5)
curses.endwin()