[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] loading images and sounds
Charles Joseph Christie II schrieb:
So, I have a helpers.py file that I imported into all of my files. It loads
sounds, images and music. However, when I load an image, I can't do anything
with it because pygame keeps saying that "tuple object has no
attribute 'blit'" and I can't do anything.
I noticed at the bottom of this helper file, it says "return image,
image.get_rect()" on it. What should I do with that then?
Here is the file that is causing the problem and the helpers.py file. this is
due on the 3RD OF MAY OH DANG IT GOT HERE FAST!!! :P
(I said I wouldn't be rushing to get it out at the end of the deadline and,
hey look, I'm rushing to get it out at the end of the deadline. Go figure.
<_< )
Help is appreciated! I need all the help I can get!
Hi
I think you function is actually returning a tuple like this:
(image_surface, image_rect)
So you can do either:
img, rect = load_img(....)
of if you want to store the tuple (for what reason):
image_tuple = load_img(...)
img = image_tuple[0]
rect = image_tuple[1] # you also could do img, rect = image_tuple
The python help and the pygame documentation should help in most of the
cases, if not, you can still ask here :-)
~DR0ID