def add_long_text(self, text):
wrapper = textwrap.TextWrapper()
wrapper.width = self.width - 4
i = 0
for line in wrapper.wrap(text):
if len(line) == 0:
self.blank_line()
else:
# get filler spaces
spaces = ''
i = self.width - len(line) - 4
while i > 0:
spaces += ' '
i -= 1
# add the line
bordered_line = colored(u'\u2502 ', self.border_color)
bordered_line += colored(line + spaces, self.text_color)
bordered_line += colored(' ' + u'\u2502', self.border_color)
self.text.append(bordered_line)
# adds a line which may contain color tags
评论列表
文章目录