pygame is
Simple DirectMedia Layer is
Site Swing



Rotate while keeping an image's center and size. I had to solve this for Trolls Outta Luckland, which needed to rotate an arbitrary image without jittering, resizing, or needing a new hitmask for each rotation. It *only* works with square images.

def rot_center(image, angle):
    """rotate an image while keeping its center and size"""
    orig_rect = image.get_rect()
    rot_image = pygame.transform.rotate(image, angle)
    rot_rect = orig_rect.copy() = rot_image.get_rect().center
    rot_image = rot_image.subsurface(rot_rect).copy()
    return rot_image

This one works with images of any dimension, but does not keep the image's original shape (retaining the original shape could truncate the image).

def rot_center(image, rect, angle):
        """rotate an image while keeping its center"""
        rot_image = pygame.transform.rotate(image, angle)
        rot_rect = rot_image.get_rect(
        return rot_image,rot_rect

our projects welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
recent releases
Sep 29, 2014

Sep 19, 2014

Sep 17, 2014

Sep 9, 2014

Sep 8, 2014

Sep 7, 2014

Sep 5, 2014

Aug 26, 2014

Aug 21, 2014

Aug 18, 2014

... more!
for pygame related questions, comments, and suggestions, please see help (lists, irc)