For your class member methods, you need to pass in 'self' as an argument. So try changing them to: def setRect(self, x, y, w, z)
and def getXposition(self) I hope that works. -Sean Berry On Dec 26, 2007 2: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! >