def push_chat(self, username, chat):
"""
write the given string at the correct position
in the chatarea
"""
# FIXME: fails when text goes beyond window limit
# highlight username
col = curses.color_pair(8)
self.chatarea.addstr(self.chat_at, 0, username + ':', col)
# write the actual chat content
self.chatarea.addstr(chat)
# update cursor
self.chat_at, _ = self.chatarea.getyx()
self.chat_at += 1
self.chatarea.refresh()
评论列表
文章目录