def draw_log(self, string):
"""Draw some logs on the screen"""
if self.logpad is not None and not self.rb.game_over():
limit = curses.LINES - self.startlog - 3
self.logpad.addstr(0, 0, " LOGS")
self.logpad.hline(1,0, "-", curses.COLS - 1)
self.logpad.hline(limit + 1,0, "-", curses.COLS - 1)
if self.loglines > limit:
self.logpad.move(2, 0)
self.logpad.deleteln()
self.logpad.move(self.loglines - 1, 0)
self.logpad.clrtoeol()
self.logpad.addstr(self.loglines - 1, 0, string)
self.logpad.hline(limit + 1,0, "-", curses.COLS - 1)
else:
self.logpad.addstr(self.loglines, 0, string)
if self.loglines <= limit:
self.loglines += 1
self.logpad.refresh(0,0, self.startlog, 0, curses.LINES - 1, curses.COLS - 1)
评论列表
文章目录