Skip to content
Advertisement

Pygame window not showing up

I recently downloaded pygame on my Mac, but for some reason, the window does not pop up with the screen or anything. I don’t get an error message, it just runs but doesn’t actually pop up a display.

JavaScript

Advertisement

Answer

Your code is currently starting, drawing a red rectangle in a window, and then ending immediatly. You should probably wait for the user to quit before closing the window. Try the following:

JavaScript

The loop in the end will ensure that the window remains open until the user closes it.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement