    def clear(self, fg, attr, bg, x=0, y=0, w=None, h=None):
        """
        Clear a box in the double-buffer.

        This does not clear the screen buffer and so the next call to deltas will still show all changes.
        Default box is the whole screen buffer.

        :param fg: The foreground colour to use for the new buffer.
        :param attr: The attribute value to use for the new buffer.
        :param bg: The background colour to use for the new buffer.
        :param x: Optional X coordinate for top left of box.
        :param y: Optional Y coordinate for top left of box.
        :param w: Optional width of the box.
        :param h: Optional height of the box.
        """
        width = self._width if w is None else w
        height = self._height if h is None else h
        width = max(0, min(self._width - x, width))
        height = max(0, min(self._height - y, height))
        line = [(" ", fg, attr, bg, 1) for _ in range(width)]
        if x == 0 and y == 0 and w is None and h is None:
            self._double_buffer = [line[:] for _ in range(height)]
        else:
            for i in range(y, y + height):
                self._double_buffer[i][x:x + w] = line[:]
Clear a box in the double-buffer.

This does not clear the screen buffer and so the next call to deltas will still show all changes.
Default box is the whole screen buffer.

:param fg: The foreground colour to use for the new buffer.
:param attr: The attribute value to use for the new buffer.
:param bg: The background colour to use for the new buffer.
:param x: Optional X coordinate for top left of box.
:param y: Optional Y coordinate for top left of box.
:param w: Optional width of the box.
:param h: Optional height of the box.
asciimatics/screen.py