[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Virtual attributes of pygame.Rect
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Virtual attributes of pygame.Rect
- From: "Jake b" <ninmonkeys@xxxxxxxxx>
- Date: Tue, 1 Jan 2008 12:59:04 -0600
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Tue, 01 Jan 2008 13:59:13 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=UqOtkdzYzQS8xRZx8QkxrQnuQug3vntlw9O//ErN4to=; b=POF9qyZ6oVgQhhVj0MAIaiyCKMWpXU80YWxcfd857jsipXdymi6idHIr+ONoi/n6KPPkXNf3d073Nz5Zf65y1rNDR2xtj4du+E/xTCkaksJs2S17u7tCWlUXygVXTeieVdcYJKWrc3lRPR6lxZfuPNnh4EkwciZz8/dll29gjGw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=s80ACom7QF2DQWvazbZtb/o/9sd445gsIZNIzm2UG/B+6mL5cT2tcK8T2a+O+GAmmUsbfSEQlV63taLYs5KLRHWGufUFU60d9w1F3K0qjqGIabmaKqEFVleJxmQNEWX/GBswVA8cHbKQjZhK9LFTJSSWKRCQrwCxmXr0ozOoCcM=
- In-reply-to: <20071226110409.am2h60rluscokgco@xxxxxxxxxxxxxx>
- References: <20071226110409.am2h60rluscokgco@xxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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@xxxxxxxx/msg05338.html
On Dec 26, 2007 4:04 AM, <p22sacam@xxxxxx> 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