Here is my full code:

```
 import pygame
pygame.init()

i = 0
x = 0

# Define the colors we will use in RGB format
BLACK = (  0,   0,   0)
WHITE = (255, 255, 255)
BLUE  = (  0,   0, 255)
GREEN = (  0, 255,   0)
RED   = (255,   0,   0)

# Set the height and width of the screen
size = [600, 300]
screen = pygame.display.set_mode(size)

pygame.display.set_caption("Test")

#Loop until the user clicks the close button.
done = False
clock = pygame.time.Clock()

while not done:
    clock.tick(10)

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done=True

    screen.fill(WHITE)

    for x in range(x, x+100, 10):
       pygame.draw.rect(screen, BLACK, [x, 0, 10, 10], 1)

    pygame.display.flip()

pygame.quit()

```

10 squares are drawn but they scroll across the window to the right and i dont know why. Is there any way I could stop this?

Thanks.

I realise now that it is not about the rectangle loop, but i have changed that to what has been suggested anyway.