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

Re: [pygame] strange rect behavior...



On Mon, Oct 10, 2005 at 08:37:36AM +0200, Lionel barret De Nazaris wrote:
>    Thank you for you answers, I grokked it later
> 
>    Still, I find this behavior strange.The doc is not very clear.
> 
>    Beside this seems to me non-standard. When you're setting the bottom right
>    of a rect, you could do it to resize or to move. Both motives are equally
>    valid and correct . Why excluding resize ?
> 
>    Beside, the attributes are in the "same bag", why a user must remember
>    which attributes is resize, which is move ? When working with many
>    libraries (home, work, different project, etc.), this becomes a bit
>    thorny. Why allow confusion ?
> 
>    My 0.02EUR
>    Lionel
> 

  rect.width = n
  rect.height = n

Are never confusing. If you are setting width or height, it is always 
obvious what should happen.

All of...

  rect.top = n
  rect.bottom = n
  rect.left = n
  rect.right = n

...reposition the whole rect. This is consistent. Suppose the scenario 
where assigning to rect.bottom would resize the rect. If assignment to 
rect.top was consistent with that, how would you reposition the rect?

Suppose you want a rect to be 30 pixels tall and positioned at the 
bottom of the screen. Which is more intuitive?...

  rect.height = 30
  rect.bottom = screen.bottom

...or...

  rect.bottom = screen.bottom
  rect.top = screen.height - 30


---
Bob the Hamster