def curses_input(self, stdscr, row, col, prompt_string, ascii_mode=False):
"""
Get an input string with curses.
Row and col are the start position ot the prompt_string.
"""
curses.echo()
stdscr.addstr(row, col, str(prompt_string), curses.A_REVERSE)
stdscr.addstr(row + 1, col, " " * (curses.COLS - 1))
stdscr.refresh()
input_val = ""
while len(input_val) <= 0:
if ascii_mode:
input_val = chr(stdscr.getch())
break
else:
input_val = stdscr.getstr(row + 1, col, 20)
return input_val
评论列表
文章目录