def __init__(self, scr, title="", inittext="", win_location=(0, 0),
win_size=(20, 80), box=True, max_paragraphs=0, pw_mode=False,
edit=True):
# Fix for python curses resize bug:
# http://bugs.python.org/issue2675
os.unsetenv('LINES')
os.unsetenv('COLUMNS')
self.scr = scr
self.title_orig = title
if sys.version_info.major < 3:
enc = locale.getpreferredencoding() or 'utf-8'
self.title_orig = str(self.title_orig, encoding=enc)
inittext = str(inittext, encoding=enc)
self.box = box
self.max_paragraphs = max_paragraphs
self.pw_mode = pw_mode
self.edit = edit
self.win_location_orig_y, self.win_location_orig_x = win_location
self.win_size_orig_y, self.win_size_orig_x = win_size
self.win_size_y = self.win_size_orig_y
self.win_size_x = self.win_size_orig_x
self.win_location_y = self.win_location_orig_y
self.win_location_x = self.win_location_orig_x
self.win_init()
self.box_init()
self.text_init(inittext)
if self.edit is False:
self.keys_init_noedit()
try:
curses.curs_set(0)
except _curses.error:
pass
else:
self.keys_init()
curses.curs_set(1)
self.display()
评论列表
文章目录