How Do I Manage Windows in PyGame?

Question:
One question in pygame how do you change a window I know that you only can have 1 window but in my game you use one window for the actual game and when you lose instead of changing the window i want to delete the old one and add this new one how do you do that ive been searching it up alot but nothing useful came all those things were telling me how to eit pygame not just the window

Hey @HaydenSmith20!

Have you tried using sys.exit() then adding the window again?

You can also use pygame.quit() instead of sys.exit().

3 Likes

Generally, the original window is enough for everything.

I think you can use pygame.display.quit() to close the display, then create a new one immediately with pygame.display.set_mode(). This won’t affect the rest of pygame probably.

2 Likes