import pygame, sys from pygame.locals import * pygame.init() #FPS = 30 # frames per second setting #fpsClock = pygame.time.Clock() # set up the window screen = pygame.display.set_mode((800, 64), 0, 32) pygame.display.set_caption('Animation') WHITE = (255, 255, 255) circleImg = pygame.image.load('circle64.png') circlex = circley = 0 dir = 1 while True: # the main game loop screen.fill(WHITE) circlex = circlex + dir if circlex > 736 or circlex < 0: dir = -1 * dir screen.blit(circleImg, (circlex, circley)) for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() pygame.display.update() # fpsClock.tick(FPS)