External Exam Download Resources Web Applications Games Recycle Bin

Draw a Square

draw a square.py

import pygame
pygame.init()
screen = pygame.display.set_mode((400, 300))
done = False
while not done:
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      done = True
      
  pygame.draw.rect( screen, (255, 255, 255), (5, 5, 50, 50) )
  
  pygame.display.flip()
pygame.quit()