def mainc(stdscr):
inp = 0
wallet = read_wallet()
y, x = stdscr.getmaxyx()
conf_scr()
stdscr.bkgd(' ', curses.color_pair(2))
stdscr.clear()
#stdscr.nodelay(1)
# while inp != 48 and inp != 27 and inp != 81 and inp != 113:
while inp not in {KEY_ZERO, KEY_ESCAPE, KEY_Q, KEY_q}:
while True:
try:
write_scr(stdscr, wallet, y, x)
except curses.error:
pass
inp = stdscr.getch()
if inp != curses.KEY_RESIZE:
break
stdscr.erase()
y, x = stdscr.getmaxyx()
if inp in {KEY_a, KEY_A}:
if y > 2:
data = get_string(stdscr,
'Enter in format Symbol,Amount e.g. BTC,10')
wallet = add_coin(data, wallet)
write_wallet(wallet)
if inp in {KEY_r, KEY_R}:
if y > 2:
data = get_string(stdscr,
'Enter the symbol of coin to be removed, e.g. BTC')
wallet = remove_coin(data, wallet)
write_wallet(wallet)
if inp in {KEY_s, KEY_S}:
if y > 2:
global ORDER
ORDER = not ORDER
if inp in {KEY_c, KEY_C}:
if y > 2:
global COLUMN
COLUMN = (COLUMN + 1) % len(SORTS)
评论列表
文章目录