import pygame as pg
pg.init()
W, H = 500, 400
screen = pg.display.set_mode((W, H))
run = True
rect = pg.Rect(50, 50, 60, 60)
screen.fill((0, 0, 0))
pg.draw.rect(screen, (255, 0, 0), rect)
while run:
for event in pg.event.get():
if event.type == pg.QUIT:
run = False
pg.display.flip()
pg.quit()
Why is the screen still black?
New contributor
1