def addString(y, x, string, string_color=color.BLACK, bold=False):
if x == position.CENTER:
x = width/2 - len(string)/2
options = 0
if curses.can_change_color():
# tokens special cases color
if string == 'X':
options = curses.color_pair(color.RED) if not bold else curses.color_pair(color.RED_H) | curses.A_BOLD
elif string == 'O':
options = curses.color_pair(color.YELLOW) if not bold else curses.color_pair(color.YELLOW_H) | curses.A_BOLD
else:
options = curses.color_pair(string_color)
if bold:
options |= curses.A_BOLD
stdscr.addstr(y, x, string, options)
stdscr.refresh()
# main display
评论列表
文章目录