Q: Pygame image, get the current image file loaded I am using the pygame.image.load to load a picture to the game surface:
self.picture = pygame.image.load("some_img.png")

While the game is running, this image file can be change (with some events), like by pressing the button y the picture in the self.picture is changed into other image file.
What I really need, is to get the current image file name loaded into the self.picture each time.
I try to print the self.picture to see what the value is but, is not a kind of picture file name but, object code:
<Surface(30x52x30 SW)>

Cheers

A: When you use pygame.image.load(), it returns a pygame.Surface object. As far as can be seen from the documentation, there is no way to find the filename of the original image back from the Surface. I would suggest using another variable to hold this name:
self.picname = "some_img.png"
self.picture = pygame.image.load(self.picname)

