I have the following code to demonstrate my problem:
import pygame
import random
import time
def randPoint(w,h):
p = int(random.random()*w),int(random.random()*h)
return p
width=1000
height=1000
screenColor=(0,0,0)
lineColor=(255,255,255)
pygame.init()
screen=pygame.display.set_mode((width,height))
count = 0
while True:
screen.fill(screenColor)
start = randPoint(width,height)
end = randPoint(width,height)
pygame.draw.line(screen, (255, 255, 255), start, end)
pygame.display.flip()
print(count)
count += 1
time.sleep(0.05)
After about 100 frames the pygame window freezes although the console continues to print new frame counts. What am I missing here?