new curses interface for testing
This commit is contained in:
24
test.py
24
test.py
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user