pygame.Rect question

Pekka Karjalainen pekkakarj at gmail.com
Mon Apr 9 04:24:30 EDT 2012


On Mon, Apr 9, 2012 at 3:29 AM, Dave Angel <d at davea.name> wrote:
> I don't know about pygame, but almost everywhere in the standard
> library, ranges are closed at the begin and open at the end.  For
> example, if you have range(30, 50), there are 20 items, numbered 30
> through 49.  I expect the same will be true for rect.right() and
> rect.bottom().

Your expectation is correct. I'll just point out the part in the
Pygame docs that spells this out.

http://www.pygame.org/docs/ref/rect.html

"The area covered by a Rect does not include the right- and
bottom-most edge of pixels. If one Rect's bottom border is another
Rect's top border (i.e., rect1.bottom=rect2.top), the two meet exactly
on the screen but do not overlap, and rect1.colliderect(rect2) returns
false."

Pekka



More information about the Python-list mailing list