0

I'm a beginner in Python and Pygame rn, but every time I try to open a Pygame window, the command window just runs an endless list of numbers. I've tried changing my code multiple times, and even copy pasted codes to open a Pygame window from multiple different websites. Different sources have some extra code added, but this is the code I tried last:

import pygame
pygame.init()
screen = pygame.display.set_mode((300, 300))
running = True
while running:
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      running = False
h0r53
  • 3,034
  • 2
  • 16
  • 25
  • This seems fine. Typically, you want games to run continually until some exit event occurs. There isn't enough information here to help you. The provided code will run forever until pygame receives a `QUIT` event. – h0r53 Oct 26 '21 at 16:13
  • So I made a new file in a different folder and it worked. So something is wrong with the folder then, but not sure what. – InboundMink Oct 26 '21 at 16:28
  • Interesting observations. But again, this is not enough information for anyone to help with here. We would need a minimal, reproducible, example of your code and the issue you are experiencing. – h0r53 Oct 26 '21 at 16:30
  • Alright. Well my main problem is fixed, so thanks for confirming there was nothing wrong in the code. – InboundMink Oct 26 '21 at 16:33
  • @h0r53 btw you can use `[mre]` to show this [mre] as for the OP it could be to do with what you called your folder or file but the given code definitely should run without issue (and without printing anything to the console) – Matiiss Oct 26 '21 at 16:38

0 Answers0