= ncurses = * http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/intro.html#WHATIS In short, it is a library of functions that manages an application's display on character-cell terminals. == Example in Python == {{{#!highlight python import curses import time import subprocess import threading class Update(threading.Thread): def __init__(self,w1,w2,w3): threading.Thread.__init__(self) self.__w1 = w1 self.__w2 = w2 self.__w3 = w3 self.__running = False def run(self): self.__stop = False self.__running = True while self.__stop==False: out = subprocess.check_output(["uptime"]) splitted = out.strip().split() one_minute = splitted[9].replace(",","") five_minutes = splitted[10].replace(",","") fifteen_minutes = splitted[11].replace(",","") self.__w1.addstr(0,0,"one minute") self.__w1.addstr(0,16,one_minute) self.__w1.refresh() self.__w2.addstr(0,0,"five minutes") self.__w2.addstr(0,16,five_minutes) self.__w2.refresh() self.__w3.addstr(0,0,"fifteen minutes") self.__w3.addstr(0,16,fifteen_minutes ) self.__w3.refresh() time.sleep(2) self.__running = False def stop(self): self.__stop = True def is_running(self): return self.__running class Screen(object): def __init__(self): self.__stdscr = curses.initscr() curses.noecho() curses.cbreak() self.__stdscr.keypad(1) def get_std_scr(self): return self.__stdscr def exit(self): curses.nocbreak() self.__stdscr.keypad(0) curses.echo() curses.endwin() def create_window(self,x,y,width,height): return curses.newwin(height, width, y, x) if __name__=='__main__': screen = None exception = "" try: screen = Screen() w1 = screen.create_window(0,0,30,1) w2 = screen.create_window(30,0,30,1) w3 = screen.create_window(60,0,30,1) w4 = screen.create_window(0,1,30,1) t = Update(w1,w2,w3) t.start() loop = True while loop: key=screen.get_std_scr().getch() if key == ord('q'): w4.addstr(0,0,"Exiting ...") w4.refresh() t.stop() while t.is_running(): time.sleep(1) loop = False except Exception as ex: exception = str(ex) finally: screen.exit() print(exception) }}}