The point I was trying to make was that if you already have a surface, use
surface.get_rect to get its bounding box, then manipulate however you want
because the width/height of the Rect gets set from the get_rect call which,
in turn, allows the Rect to behave as you would expect. No need to calc the
width/height in that case.
Of course, I may have misunderstood what you are trying to do.. :)
Cheers,
Taylor
----- Original Message -----
From: "Rikard Bosnjakovic" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, June 28, 2006 11:23 PM
Subject: [code] Re: [pygame] Re: Question regarding a Rect()-object
On 6/29/06, Taylor Boon <[EMAIL PROTECTED]> 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.