Advertisement
zeroblitzt

Curses Scroll test (K.Novak)

Feb 17th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. #Curses test script, by K. Novak
  2.  
  3. import curses
  4. stdscr = curses.initscr()
  5. stdscr.keypad(1)
  6.  
  7. #find terminal height and width
  8. mheight,mwidth = stdscr.getmaxyx()
  9.  
  10. oWin = curses.newwin(mheight-1,mwidth,0,0)
  11. iWin = curses.newwin(1,mwidth,mheight-1,0)
  12. oWin.scrollok(1)
  13. iWin.scrollok(1)
  14.  
  15. #function for refreshing the windows
  16. def ref_oWin(xc, yc):
  17.     oWin.refresh()
  18.    
  19. def ref_iWin(xc,yc):
  20.     iWin.addstr(">")
  21.     iWin.refresh()
  22.    
  23. q = 1
  24. while q == 1:
  25.     ref_oWin(0,0)
  26.     ref_iWin(0,0)
  27.    
  28.     event = iWin.getstr(0,1)
  29.     if event == "/quit":
  30.         q = 2
  31.         break
  32.     else:
  33.         oWin.addstr(event + "\n")
  34.        
  35.  
  36.  
  37. curses.endwin()
  38. quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement