2008/11/6 Christopher Spears <[EMAIL PROTECTED]>:
> I inserted this code snippet into the Spaceship class:
>
> self.rect = self.image.get_rect()
> print self.rect
> self.rect = self.rect.inflate(-50, -50)
> print self.rect
>
> The following was printed to my console:
> <rect<0, 0, 70, 53>>
> <rect<25, 25, 20, 37>>
>
> I'm assuming that the first two numbers are coordinates for the upper left 
> corner of the rectangle.  The third and fourth numbers are the width and 
> height of the rectangle from the upper left corner.  Am I off base here?
> If that is the case, why does rect.inflate() move the upper left corner?

At a guess: the inflation (or, in this case, deflation) is centred on
the centre of the figure.  So a horizontal change of -50 means the
left edge moves 25 pixels right and the right edge moves 25 pixels
left.  (or, rather, the total width drops frrom 70 pixels to 20
pixels)

I'm not sure what's going on with the height, though.

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to