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()
and this error pop ups:
Exception has occurred: ValueError
invalid rectstyle object
File “myfolder/myfile.py”, line 9, in
screen.fill(0,0,0)
ValueError: invalid rectstyle object
i tried
screen.fill((0,0,0))
pg.draw.rect(screen, ((255,0,0)), rect)
error fixed but the screen still black
New contributor