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

Re: [pygame] Rect Behavior



On 2010.5.16 3:25 PM, Ian Mallett wrote:
Hi,

So, I've noticed that, when trying to draw a n*1 or 1*n rectangle (yes I
know a line does the job too) with pygame.draw.rect(...), the behavior
is different for different fills.  When the fill is 0, nothing draws!
When the fill is 1, the desired rectangle is drawn.  Is this the
expected behavior of pygame.draw.rect(...)?

Thanks,
Ian

Probably because the rect function assumes a variable-width border. ( http://www.pygame.org/docs/ref/draw.html#pygame.draw.rect ) There's no "fill" argument, only a "border width" argument. So if that's 0, Pygame probably gets confused and draws 0 pixels of border, 0 of interior.

Why not use pygame.draw.line if you only want one pixel width anyway?