def prompt(self, text, options, default=None):
""" Request input from user """
self.stdscr.addstr(self.row, 0, text)
self.stdscr.addstr(" (" + ",".join(options) + ") ")
if default != None:
self.stdscr.addstr("[" + default + "] ")
self.nextrow()
answer = None
while answer not in options:
curses.echo()
answer = self.stdscr.getstr()
curses.noecho()
if answer == "" and default != None:
answer = default
return answer
评论列表
文章目录