0

I just updated to pygame 2.0.0 and tried to run this basic window:

import pygame,sys 

pygame.init()
screen = pygame.display.set_mode((800,800))
clock = pygame.time.Clock()

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

    pygame.display.flip()
    clock.tick(60)

When I run the code I get the welcome message:

pygame 2.0.0 (SDL 2.0.12, python 3.9)
Hello from the pygame community. https://www.pygame.org/contribute.html

But no window is being displayed and when I run other projects (that worked in pygame 1.9.6) I also don't get a window (but the welcome message is displayed and there is no error).

Do I need to add another line of code now? I am not sure what the problem is. (I am using windows 10)

What I tried so far:

  • I tried both python 3.8.6 and python 3.9, neither displays a window
  • When going back to pygame 1.9.6 everything works fine again (python 3.8.6)
  • I updated and tried pygame on another windows pc (with python 3.8.3) and I get the same result: Welcome message, no error and no window

edit:

  • So far I run the code in sublime but then tried to run the code from the powershell... and that works perfectly fine. I am really confused now.
Another_coder
  • 728
  • 1
  • 9
  • 23
  • What OS and Python version are you on? Does [this](https://stackoverflow.com/questions/58937348/pygame-window-not-opening) help at all? – Random Davis Oct 30 '20 at 16:58
  • Added it now, windows 10 and python 3.9 – Another_coder Oct 30 '20 at 16:59
  • Have you tried [this](https://stackoverflow.com/questions/64305748/how-to-install-pygame-in-windows-10-for-python-3-9)? Also it would be helpful for you to explain what you've done to troubleshoot/search for the issue already. – Random Davis Oct 30 '20 at 17:02
  • Not sure if `pygame` works with 3.9. Python 3.9 does not support many other packages like `numpy` Consider switching to python 3.8.5 – Pro Chess Oct 30 '20 at 17:02
  • The python version does not seem to make a difference: I initially opened it in python 3.8.6 and I got the same results, afraid the link above also does not help. I honestly have no idea what I could be doing for troubleshooting actually, the code is so simple... is there anything that could interfere? – Another_coder Oct 30 '20 at 17:06
  • 1
    @Another_coder make sure the python version you're launching and installing the module in is actually the right one, it's possible you have other installations that are being used. – Random Davis Oct 30 '20 at 18:12

0 Answers0