Oops..sorry, I forgot putting the "self" argument, I mean, in fact
that argument is on my code. I found that when I initialysed (is this
correct?) my self.rect variable, I was doing self.rect=0, and that
seems to be the problem, now I do self.rect=pygame.Rect(0,0,0,0) and
now it goes well... I think xD.
Thanks!
El 01/01/2008, a las 19:59, Jake b escribió:
If the self argument ( sean's post ) doesn't fix the problem, it could
be that the Rect() is actually a tuple. I ran into this before.
To fix this, see:
http://www.mail-archive.com/pygame-users@seul.org/msg05338.html
On Dec 26, 2007 4:04 AM, <[EMAIL PROTECTED]> wrote:
Hi everyone,
First of all,merry Xmas!
I would like to ask about the virtual attributes of pygame.Rect (I
mean: top, left,centerx...and so on)
I have 2 classes, board() and square(). At class Square I have
some methods like:
def setRect(x,y,w,z):
self.rect=pygame.Rect(x,y,w,z)
def getXposition():
print "value top left: ", self.rect.left#this is only to check
the value is correct
return self.rect.left
And then at Board() class I have instances of Square():
newSquare= Square()
After that I asign rects values with newSquare.setRect(x,y,w,z),
but when I try to access to the "left" virtual attribute with
newSquare.getXposition, it says me that the object doesn't have a
left attribute when in getXposition I try to print the value.
Does anyone know, more or less, what I'm doing wrong?
Thanks for all!
--
Jake