[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Re: Question regarding a Rect()-object



On 6/29/06, Taylor Boon <tboon@xxxxxxxxxxx> wrote:
It does look like once the width is set into a Rect object it
behaves the way you would expect:

>>> r = Rect(0, 0, 100, 100)
>>> r.left = 10
>>> r.top = 10
>>> r
<rect(10, 10, 100, 100)>

What you are doing above is to change x/y-position, argument 3 and 4 are width and height respectively, not the opposite corner of the rect (as I thought at first). The width and height remains the same, you just move the box around at new coordinates.

If you want to "strech" the rect but setting r.right to some other
value, say 123, x gets changed as well. The only way to strech a rect
seem to be by altering the width or height, and that's what confused
me.