In this guide, we will be creating the PyGame game window. If you don’t have a PyGame project setup yet, you can learn how to set one up here. In your main game file, you can add the following two lines to create our game window:
display = pygame.display.set_mode((800, 600)) pygame.display.set_caption('My Window Title')
When you run the game, you should see a window appear for a couple seconds, then disappear. Take a look at this part of the series, where we add the game loop. After adding the game loop, your game window will no longer disappear.
Now you know how to create a PyGame game window! If you found this guide helpful, you may consider checking out the rest of this series. To receive news regarding our future tutorials and courses, you can subscribe to our newsletter.
Sharing this guide on your favorite social media platform would be much appreciated, if you found this tutorial valuable.Tags: cross-platform, Python
Categorised in: PyGame Basics
This post was written by Jared York