I have recently learnt about Pygame, and wrote a simple program with it. I made other programs before, but suddenly, they all stopped working, and nothing is drawing anymore.
`import pygame
pygame.init()
windowWidth = 1920
windowHeight = 1080
window = pygame.display.set_mode((windowWidth, windowHeight))
pygame.display.set_caption("WHY DOES THIS NOT WORK")
player1 = pygame.Rect(0, 0, 100, 100)
running = True
while running:
window.fill((0, 0, 0)) # Fill the window with black
pygame.draw.rect(window, (255, 255, 255), player1) # Draw the rectangle
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.display.flip() # Update the display
pygame.quit()`
I have no idea where I could’ve gone wrong…
I tried rewriting the whole program, copy and pasting it in different files, but nothing is working. Any help?
New contributor
Sam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.