def angry_horse(self, *status_line): # Use the angry horse if there's enough space for it. rows, columns, lines = load_ascii_art('angry-horse') # Otherwise hope the dumb horse is small enough. if rows >= self.height or columns >= self.width: rows, columns, lines = load_ascii_art('dumb-horse') self.redraw() for idx, line in enumerate(lines): x = (self.width - columns) / 2 y = (self.height - rows) / 2 + idx self.stdscr.addstr(y, x, line, curses.A_BOLD) self.layout.status(*status_line) self.stdscr.refresh() time.sleep(0.2) self.redraw() self.layout.status(*status_line)
def draw(self): rows, columns, lines = load_ascii_art('doge-horse') height, _ = self.window.getmaxyx() # End of the horse ride. if self.index >= self.width: raise RemoveHorseHandler for idx, line in enumerate(lines): self.window.addstr(height - rows - 2 + idx - self.gallop(), self.index, line[:self.width - self.index]) self.index += 2 self.window.refresh() time.sleep(0.1)