#loading resources def load_image(_file_, colorkey=None): fullname = os.path.join(os.path.dirname(__file__), _file_) try: image = pygame.image.load(fullname) except pygame.error, message: print 'cannot load image:' _file_ raise SystemExit, message iamge = image.convert() if colorkey is not None: if colorkey is -1: colorkey = image.get_at((0, 0)) image.set_colorkey(colorkey, RLEACCEL) return image, image.get_rect()