Actually, your code isn't failing. For Rects, 'top' references only the
y-value of the top edge of the rectangle.

If you're looking for a pair of numbers, check out 'topleft', 'midtop', or
'topright'.

The second value for those three will be the same value as 'top'.

I hope that makes sense.

-Sean

On Jan 14, 2008 2:53 PM, marta sanz <[EMAIL PROTECTED]> wrote:

> Hi there!
> I have a little problem with that function image.get_rect() and that
> is that after loading an image, I try to obtain its rect but it does
> nothing...
>
> in my code I do this:
> def __init__ (pygame.sprite.Sprite):
>        ...
>        self.counterArea=pygame.Rect(0,0,0,0)
>        ...
>
> ....
> def loadCounter(self):
>        ...
>        self.counterImage= pygame.image.load("....")
>
>        self.counterImage= self.counterImage.convert()
>
>        self.counterArea= self.counterImage.get_rect()
>        ...
>
> and when I do :
>
> print "Top: ", self.counterArea.top
>  >>>0
>
> Does anyone have any idea of where do my code fails? I have look for
> examples and info, but all I see seems to say I'm right, so what's
> wrong?
>
> Thanks so much.
> Regards..
> Marta.
>

Reply via email to