(self, degrees, clockwise=False)
return self * rotation
Returns an AffineTransform which is rotated by the given number
        of degrees. Anticlockwise unless clockwise=True is given.
Returns an AffineTransform which is rotated by the given number
        of degrees. Anticlockwise unless clockwise=True is given.
Returns an AffineTransform which is rotated by the given number of degrees . Anticlockwise unless clockwise = True is given .
def rotate(self, degrees, clockwise=False):
        """
        Returns an AffineTransform which is rotated by the given number
        of degrees. Anticlockwise unless clockwise=True is given.
        """
        degrees %= 360
        if clockwise:
            degrees = 360 - degrees
        theta = degrees * pi / 180.0

        # HACK: limited precision of floats means rotate() operations
        # often cause numbers like 1.2246467991473532e-16.
        # So we round() those to 15 decimal digits. Better solution welcome :/
        rotation = AffineTransform((
            round(cos(theta), 15), round(-sin(theta), 15), 0,
            round(sin(theta), 15), round(cos(theta), 15), 0,
            0, 0, 1,
        ))
        return self * rotation
def rotate ( self , degrees , clockwise = False ) : degrees %= 360 if clockwise : degrees = 360 - degrees theta = degrees * pi / 180.0 # HACK: limited precision of floats means rotate() operations # often cause numbers like 1.2246467991473532e-16. # So we round() those to 15 decimal digits. Better solution welcome :/ rotation = AffineTransform ( ( round ( cos ( theta ) , 15 ) , round ( - sin ( theta ) , 15 ) , 0 , round ( sin ( theta ) , 15 ) , round ( cos ( theta ) , 15 ) , 0 , 0 , 0 , 1 , ) ) return self * rotation