I'm new to pygame. Installed it successfully and displayed a window. However, I couldn't get it to run anything beyond this. Background colors are not changing, lines are not drawn. Nothing. Window just stays open with white screen. I've used an example program to check if its running still I got the same results, a blank white window. Here is the code that I used.
import pygame as pg
import random
if __name__ == '__main__':
running = True
pg.init()
screen = pg.display.set_mode((600, 400))
screen_rect = screen.get_rect()
clock = pg.time.Clock()
timer = 0
bg = (random.randint(0, 255), random.randint(
0, 255), random.randint(0, 255))
while running:
screen.fill(bg)
for event in pg.event.get():
if event.type == pg.QUIT:
running = False
if pg.time.get_ticks()-timer > 1000:
timer = pg.time.get_ticks()
bg = (random.randint(0, 255), random.randint(
0, 255), random.randint(0, 255))
pg.display.update()
pg.display.flip()
clock.tick(60)
can I get some help please? Is there anything wrong in my installation?