Advertisement
Guest User

Untitled

a guest
Feb 9th, 2013
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. import curses
  3. import sys
  4.  
  5. class Subwin():
  6.   def __init__(self, screen, size_lines, size_col):
  7.     self.screen = screen
  8.     self.win = screen.subwin(size_lines, size_col, 1, 1)
  9.  
  10.   def test(self):
  11.     y_max, x_max = self.win.getmaxyx()
  12.     for y in range(y_max):
  13.       for x in range(x_max):
  14.         try:
  15.           self.win.addch(y, x, '*')
  16.         except curses.error:
  17.           self.screen.addstr(6, 0, 'Exception on Line: {} Column: {}'.format(y+1, x+1))
  18.           self.screen.getch()
  19.  
  20. scr = curses.initscr()
  21.  
  22. w = Subwin(scr, 5, 11)
  23. w.test()
  24. w.screen.refresh()
  25.  
  26. curses.endwin()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement