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

Re: [pygame] strange rect behavior...



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.02€
Lionel

Peter Shinners wrote:
On Sun, 2005-10-09 at 12:13 +0200, Lionel barret De Nazaris wrote:
  
If I write :
rect = pygame.Rect([0,0,0,0])
rect.bottom = 100
print rect.height

I get :
0
    


This is "correct" because setting the Rect attributes moves the rectangles.
You can set the "width", "height", and "size" attributes to change the Rect size,
in these cases the top,left edge will not be moved.

It may be more clear on a Rect with dimensions.

  
a = pygame.Rect(0, 0, 10, 10)
a.bottom = 100
print a.top
        
90