def drawFrame(self, refreshScreen=True, frame=None, topLine = 0, col_offset = 0, line_offset = 0, preview=False):          # rename to redraw()?
        """ Like refresh() below, but only draws the frame passed in, not a whole movie. """
        #topLine = self.appState.topLine
        topLine = 0
        # Figure out the last line to draw
        lastLineToDraw = topLine + self.appState.realmaxY - 3 # right above the status line
        if lastLineToDraw > frame.sizeY:
            lastLineToDraw = frame.sizeY
        screenLineNum = 0
        firstCol = self.appState.firstCol
        lastCol = min(frame.sizeX, self.appState.realmaxX + firstCol)
        # Draw each character
        for linenum in range(topLine, lastLineToDraw):
            line = frame.content[linenum]
            for colnum in range(firstCol, lastCol):
                charColor = frame.newColorMap[linenum][colnum]
                charContent = str(line[colnum])
                try:
                    # set ncurss color pair
                    cursesColorPair = self.ansi.colorPairMap[tuple(charColor)] 
                except: # Or if we can't, fail to the terminal's default color
                    cursesColorPair = 0
                if charColor[0] > 8 and charColor[0] <= 16 and self.appState.colorMode == "16":    # bright color
                    self.addstr(screenLineNum + line_offset, colnum - self.appState.firstCol + col_offset, charContent, curses.color_pair(cursesColorPair) | curses.A_BOLD)
                elif charColor[0] > 7 and charColor[0] <= 15 and self.appState.colorMode == "256":    # bright color
                    self.addstr(screenLineNum + line_offset, colnum - self.appState.firstCol + col_offset, charContent, curses.color_pair(cursesColorPair) | curses.A_BOLD)
                # If the mouse cursor is over Fg: 1 Bg:1 in 16 color mode, aka Black on Black
                # then print with defualt charaacters instead. This should prevent the cursor from
                # disappearing, as well as let you preview "invisible" text under the cursor.
                else:
                    self.addstr(screenLineNum + line_offset, colnum - self.appState.firstCol + col_offset, charContent, curses.color_pair(cursesColorPair))
            # draw border on right edge of line
            if not preview and self.appState.drawBorders and screenLineNum + topLine < self.frame.sizeY:
                self.addstr(screenLineNum, frame.sizeX, ": ", curses.color_pair(self.appState.theme['borderColor']))
            screenLineNum += 1
        # draw bottom border
        #if self.appState.drawBorders and screenLineNum < self.realmaxY - 3 :
        if not preview and self.appState.drawBorders and screenLineNum + topLine == frame.sizeY:
            if screenLineNum < self.statusBarLineNum:
                borderWidth = min(frame.sizeX, self.realmaxX)
                self.addstr(screenLineNum, 0, "." * borderWidth, curses.color_pair(self.appState.theme['borderColor']))
                self.addstr(screenLineNum, frame.sizeX, ": ", curses.color_pair(self.appState.theme['borderColor']))
        screenLineNum += 1
        #spaceMultiplier = mov.sizeX + 1
        spaceMultiplier = self.realmaxY
        #for x in range(screenLineNum, self.realmaxY - 2):
        #    self.addstr(x, 0, " " * spaceMultiplier)
        #curses.panel.update_panels()
        if refreshScreen:
            self.stdscr.refresh()
 Like refresh() below, but only draws the frame passed in, not a whole movie. 
durdraw/durdraw_ui_curses.py