Traceback (most recent call last):
File "G:/Computing/Project/Main.py", line 32, in <module>
ClubsImages, SpadesImages, HeartsImages, DiamondsImages = LoadImages()
File "G:/Computing/Project/Main.py", line 18, in LoadImages
ClubsImages[i] = pygame.image.load(("Images/",x,".png"))
pygame.error: Can't seek in this data source
I get this error when I run this code:
def LoadImages():
SpadesImages = {}
ClubsImages = {}
HeartsImages = {}
DiamondsImages = {}
x = 1
for i in range (13):
ClubsImages[i] = pygame.image.load(("Images/",x,".png"))
x+=1
SpadesImages[i] = pygame.image.load(("Images/",x,".png"))
x+=1
HeartsImages[i] = pygame.image.load(("Images/",x,".png"))
x+=1
DiamondsImages[i] = pygame.image.load(("Images/",x,".png"))
x+=1
return ClubsImages, SpadesImages, HeartsImages, DiamondsImages
I have read files like this before, except this is the first time I have tried to do it into an array and in a loop. The problem is not the loop so I have taken that out and tried it and I get an identical error. So I am thinking it's the array. I can't see any reason that you couldn't read images into an array.