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

Re: [pygame] Fill a Rect object with color?



Hi

even simpler:

image.fill(color, rect)

~DR0ID

Russell Cumins schrieb:
Or you can create a surface the size of the rect and use the Surface's fill() method.

E.g.

position = x,y = 0,0
size = w,h = 32,32
colour = 0,255,0
rect = Rect(position, size)
image = Surface(size)
image.fill(colour)



2009/11/7 Ian Mallett <geometrian@xxxxxxxxx <mailto:geometrian@xxxxxxxxx>>

    I don't think rect objects were meant for that.  You could go:

    rect = a rect object
    pygame.draw.rect(surface,color,rect,0)

    Ian