[Image-SIG] my solution (formerly "enough")

Jack Uretsky jlu at hep.anl.gov
Sun Aug 22 22:25:04 CEST 2010


Hi all-
 	Following a suggestion of Yuri's. with assistance from the book 
"Beginning Game Development" by Will McGugan (Apress (registered) 
(Berkeley, CA 2007), here is my solution to the problem of switching 
images (you can substitute anything you have hadny for the images used for 
"back1" and "back2":
____________________________________________________
back1 = "a_1.jpg"
back2 = "a_2.jpg"

import pygame
from pygame.locals import *
from sys import exit
import time

pygame.init()

screen = pygame.display.set_mode((640,480), 0, 32)
pygame.display.set_caption("Hello, World!")
back = pygame.image.load(back1).convert()

pygame.event.pump()

screen.blit(back, (0,0))

pygame.display.update()

time.sleep(2)
back = pygame.image.load(back2).convert()
screen.blit(back, (0,0))

pygame.display.update()
______________________________________________
As you can see, the image can be updated, mulotiple times.
 	My thanks to all who offered suggestions.
 					Regards,
 						Jack

"Trust me.  I have a lot of experience at this."
 		General Custer's unremembered message to his men,
 		just before leading them into the Little Big Horn Valley





More information about the Image-SIG mailing list