[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Image error



Lenard Lindstrom wrote:
Samuel Mankins wrote:
When I try to load a .png image, it gives me this error:

Traceback (most recent call last):
File "/Users/samuelmankins/Desktop/PvsN/alpha/PvsN.py", line 270, in ?
MainWindow.MainLoop()
File "/Users/samuelmankins/Desktop/PvsN/alpha/PvsN.py", line 32, in MainLoop
self.LoadSprites();
File "/Users/samuelmankins/Desktop/PvsN/alpha/PvsN.py", line 208, in LoadSprites
self.sword = ninjaWeapon(6, 4, 2, 0, img, img2)
File "/Users/samuelmankins/Desktop/PvsN/alpha/weaponSprites.py", line 33, in __init__
self.image_trans = pygame.transform.rotate(self.image_call, 0)
TypeError: argument 1 must be pygame.Surface, not tuple
samuel-mankins-ibook-g4:~/Desktop/PvsN/alpha samuelmankins$


The thing is, this particular weapon Sprite has two images, so it can be "animated", and when it only had one, it worked just fine. There's also another, of the exact same class, that just loads the same image twice and works just fine. All the images involved are .pngs, and the working sprite is loaded before this one.
The code that loads the sprite and feeds it the images:


img = load_image('sword-1.png',-1)

If this is the load_image() from the examples then it returns a (surface, rect) tuple.


It is. I guess I hadn't looked at it carefully enough.
Thanks!
--Skizzaltix