def getstr(cls, x=None, y=None, prompt=None):
'''
Get string input from user at position, with optional prompt message.
:param x: optional x value
:param y: optional y value
:param prompt: message to prompt user with, example: "Name: "
:return: the string the user input
'''
x, y = cls._fix_xy(x, y)
if prompt is not None:
cls.WINDOW.addstr(y, x, prompt)
x += len(prompt)
curses.echo()
s = cls.WINDOW.getstr(y, x)
curses.noecho()
return s.decode('utf-8')
评论列表
文章目录