Advertisement
Guest User

scroll

a guest
Dec 5th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. def append_data(self, nick, data):
  2.         string = "%s (%s): %s\n" % (time.strftime("%H:%M"),
  3.                   nick, data)
  4.         rows, cols = self.p.getmaxyx()
  5.         lines = int(len(string) / cols) + 1
  6.  
  7.         self.num_lines += lines
  8.         if self.num_lines >= rows:
  9.             self.p.resize(self.num_lines + IRCTab.INCR_SIZE, cols)
  10.             self.scroll = True
  11.         if self.scroll:
  12.             self.y += lines
  13.         self.buf += string
  14.         self.p.addstr(string)
  15.  
  16.     def refresh_data(self, rows, cols):
  17.         self.p.refresh(self.y, 0, 1, 0, rows - 3, cols)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement