def start(self): """ Window event loop """ self.window = _curses.initscr() _curses.savetty() _curses.start_color() _curses.use_default_colors() self.window.leaveok(1) _curses.raw() self.window.keypad(1) _curses.noecho() _curses.cbreak() _curses.nonl() _curses.curs_set(0) if self.blocking: self.window.nodelay(0) else: self.window.nodelay(1) self.running = True while self.running: self.cycle() if self.friendly and not self.blocking: time.sleep(self.delay) self.stop()
def start(self): """ Window event loop """ self.window = _curses.initscr() _curses.savetty() _curses.start_color() _curses.use_default_colors() self.window.leaveok(1) _curses.raw() self.window.keypad(1) _curses.noecho() _curses.cbreak() _curses.nonl() _curses.curs_set(0) if self.blocking: self.window.nodelay(0) else: self.window.nodelay(1) self.running = True while self.running: self.draw() self.process_input() if self.friendly and not self.blocking: time.sleep(self.delay) self.stop()
def init(cls): # sets up the initial state of the console - performs bootstrapping of the curses library # note this isn't an instance initialisation method (they're called __init__) cls.__screen = _curses.initscr() _curses.start_color() _curses.noecho() _curses.cbreak() _curses.curs_set(0)
def start_color(): import _curses, curses retval = _curses.start_color() if hasattr(_curses, 'COLORS'): curses.COLORS = _curses.COLORS if hasattr(_curses, 'COLOR_PAIRS'): curses.COLOR_PAIRS = _curses.COLOR_PAIRS return retval
"""curses
screen = _curses.initscr() width = screen.getmaxyx()[1] height = screen.getmaxyx()[0] size = width * height char = [" ", ".", ":", "^", "*", "x", "s", "S", "#", "$"] b = [] _curses.curs_set(0) _curses.start_color() _curses.init_pair(1, 0, 0) _curses.init_pair(2, 1, 0) _curses.init_pair(3, 3, 0) _curses.init_pair(4, 4, 0) screen.clear for i in range(size + width + 1): b.append(0) while 1: