pygame freezes in this loop at around cycle 150. The loop continues, but pygame stops updating here's my code:
import pygame
from cv2 import imread # the only one needed! (to get image size) could of used pygame though...
image = imread("frame0.jpg") # get the first frame to get size of framed video
h, w, channels = image.shape
screen = pygame.display.set_mode((w,h)) # define the surface
c = pygame.time.Clock()
for i in range(0,4099): # i know this is VERY inefficent... start frame - end frame
im = pygame.image.load("./frame%d.jpg" % i) #load frame
screen.blit(im, [0, 0]) # put the image on the surface
pygame.display.update() # update time! where you've been?
screen.fill((0,0,0)) # delete canvas after update the events can be below due to the update occuring next cycle
print(i) # debug
del im # delete image variable (not necessary)
c.tick(30) # tick the clock! tick tock!!
print("done!")
so what this code is supposed to do is play a series of images in a folder. but pygame freezes and the loop continues. and this is a for loop. is it my update method? is there a way to fix this?
also, if i lower the frame rate to something like 10, the same thing happens at the same frame. is there a limit to pygame.display.update()
?