SUCCESS!!
I created a set of 10 surfaces and blited the 10 images into them. Then in my main loop I blited the surfaces to the display.
I'm now getting about 12.5 images per second (0.08 sec per image)
Your comment earlier about RAM does make me wonder what will happen when I go with the full sized images, and try to add even more images (I'd like to try this with maybe 60 images). But at least this is working at the current stage at a very respectable flicker rate.
I also haven't added any code to sample a pin at the GPIO, which was also part of my plan for controlling this. And that will no doubt slow things down.
Here's what I did, in case somebody else is trying to do something similar:
Code: Select all
import pygame
pygame.init()
screen = pygame.display.set_mode((0,0),pygame.FULLSCREEN)
done = False
image1 = pygame.image.load("./images2/painting1.jpg")
image2 = pygame.image.load("./images2/painting2.jpg")
image3 = pygame.image.load("./images2/painting3.jpg")
image4 = pygame.image.load("./images2/painting4.jpg")
image5 = pygame.image.load("./images2/painting5.jpg")
image6 = pygame.image.load("./images2/painting6.jpg")
image7 = pygame.image.load("./images2/painting7.jpg")
image8 = pygame.image.load("./images2/painting8.jpg")
image9 = pygame.image.load("./images2/painting9.jpg")
image10 = pygame.image.load("./images2/painting10.jpg")
back1 = pygame.Surface(screen.get_size())
back1 = back1.convert()
back1.blit(image1,(0,0))
back2 = pygame.Surface(screen.get_size())
back2 = back2.convert()
back2.blit(image2,(0,0))
back3 = pygame.Surface(screen.get_size())
back3 = back3.convert()
back3.blit(image3,(0,0))
back4 = pygame.Surface(screen.get_size())
back4 = back4.convert()
back4.blit(image4,(0,0))
back5 = pygame.Surface(screen.get_size())
back5 = back5.convert()
back5.blit(image5,(0,0))
back6 = pygame.Surface(screen.get_size())
back6 = back6.convert()
back6.blit(image6,(0,0))
back7 = pygame.Surface(screen.get_size())
back7 = back7.convert()
back7.blit(image7,(0,0))
back8 = pygame.Surface(screen.get_size())
back8 = back8.convert()
back8.blit(image8,(0,0))
back9 = pygame.Surface(screen.get_size())
back9 = back9.convert()
back9.blit(image9,(0,0))
back10 = pygame.Surface(screen.get_size())
back10 = back10.convert()
back10.blit(image10,(0,0))
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
done = True
screen.blit(back1,(0,0))
pygame.display.flip()
screen.blit(back2,(0,0))
pygame.display.flip()
screen.blit(back3,(0,0))
pygame.display.flip()
screen.blit(back4,(0,0))
pygame.display.flip()
screen.blit(back5,(0,0))
pygame.display.flip()
screen.blit(back6,(0,0))
pygame.display.flip()
screen.blit(back7,(0,0))
pygame.display.flip()
screen.blit(back8,(0,0))
pygame.display.flip()
screen.blit(back9,(0,0))
pygame.display.flip()
screen.blit(back10,(0,0))
pygame.display.flip()
pygame.quit()