[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Problem with get_rect()
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Problem with get_rect()
- From: Ari Cheslow <iamchillin@xxxxxxxxx>
- Date: Tue, 19 Jul 2005 13:33:06 -0700
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Tue, 19 Jul 2005 16:34:06 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=V6LhwnYjOfHZKIY/hEIfDeJJvvM7zpd+DN6GOVm4dkWk4Zt89fjNIYWDwppX/oHYrhaQ+cwQQPge2AlZJTJxwnWlykP1o6qv4IBAfMESIcNvdphXG0DxlWtLfojyJNolWcJWLkl93sZjGcWFywruEpNMzbcw6yo6ZbGFc6+Wst0=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hello, my name is Ariel. I've been on the list for awhile, but I
neither had a problem, a solution, nor a game to announce so I've
refrained so far from sending anything. Course now I have a problem
:p
I've been working on a game of mine called Runtling and I've ran into
a little problem with pygame.Surface.get_rect() It says in the pygame
documentation that get_rect takes keyword arguments. However I've ran
into error saying that it doesn't
The error is as follows:
Traceback (most recent call last):
File "C:\Python\Runtling\Runtling.py", line 83, in -toplevel-
if __name__ == "__main__": main()
File "C:\Python\Runtling\Runtling.py", line 68, in main
rect = i.rect()
File "C:\Python\Runtling\Objects.py", line 77, in rect
return self.ani.image().get_rect(center=self.pos)
TypeError: get_rect() takes no keyword arguments
the relavent classes:
class Widget:
def __init__(self, animation, position, surface):
self.ani, self.pos, self.sur = animation, position, surface
def rect(self):
return self.ani.image().get_rect(center=self.pos)##This is line 77
def update(self):
surface.blit(self.ani.update(), self.rect())
class Animation:
def __init__(self, frames):
self.images = frames
self.ticks = 0
self.repeated = False
def update(self):
self.ticks += 1
leng = len(self.images)
if self.ticks > leng * F_RATE:
self.ticks = 0
self.repeated = True
return self.images[self.ticks / F_RATE]
def image(self):
return self.images[self.ticks / F_RATE]
def reset(self):
self.ticks = 0
self.repeated = False
--
Always chilling, never caring