import pygame def run_game(): ## Initialize the pygame submodules and set up the display window. pygame.init() width = 640 height = 480 game_window = pygame.display.set_mode((width,height)) # load the balloon picture and convert it into Pygame's internal # image format balloon = pygame.image.load("balloon.gif") balloon = balloon.convert() # the width and height of the image; we don't use them for # anything right now, but you may later. balloon_w = balloon.get_width() balloon_h = balloon.get_height() # place the balloon image in the upper left hand corner of the # screen balloon_x = 0 balloon_y = 0 ## The game loop starts here. keepGoing = True while (keepGoing): ## Handle events. for event in pygame.event.get(): if event.type == pygame.QUIT: keepGoing = False ## Draw picture and update display game_window.fill(pygame.color.Color("darkblue")) game_window.blit(balloon, (balloon_x,balloon_y)) pygame.display.update() ## The game loop ends here. pygame.quit() ## Call the function run_game. run_game()