(self, margins)
return self.__class__(nx1, ny1, nx2, ny2)
Contracts the rectangle by the given margins.

        @return: a new L{Rectangle} object.
Contracts the rectangle by the given margins.
Contracts the rectangle by the given margins .
def contract(self, margins):
        """Contracts the rectangle by the given margins.

        @return: a new L{Rectangle} object.
        """
        if isinstance(margins, int) or isinstance(margins, float):
            margins = [float(margins)] * 4
        if len(margins) != 4:
            raise ValueError("margins must be a 4-tuple or a single number")
        nx1, ny1 = self._left + margins[0], self._top + margins[1]
        nx2, ny2 = self._right - margins[2], self._bottom - margins[3]
        if nx1 > nx2:
            nx1 = (nx1 + nx2) / 2.0
            nx2 = nx1
        if ny1 > ny2:
            ny1 = (ny1 + ny2) / 2.0
            ny2 = ny1
        return self.__class__(nx1, ny1, nx2, ny2)
def contract ( self , margins ) : if isinstance ( margins , int ) or isinstance ( margins , float ) : margins = [ float ( margins ) ] * 4 if len ( margins ) != 4 : raise ValueError ( "margins must be a 4-tuple or a single number" ) nx1 , ny1 = self . _left + margins [ 0 ] , self . _top + margins [ 1 ] nx2 , ny2 = self . _right - margins [ 2 ] , self . _bottom - margins [ 3 ] if nx1 > nx2 : nx1 = ( nx1 + nx2 ) / 2.0 nx2 = nx1 if ny1 > ny2 : ny1 = ( ny1 + ny2 ) / 2.0 ny2 = ny1 return self . __class__ ( nx1 , ny1 , nx2 , ny2 )