Search code examples
pythonpygamescreen-size

How to make the PyGame window open in full-screen mode


I'm working with pygame to make an alien shooter game. I want to make the game window adapt to the user's screen size so that it automatically starts in full-screen mode, by detecting their screen size. I'm thinking of using pygame.display.set_mode((screen_width, screen_height)), but I don't know how to make Python detect the user's screen size. How do I do that?


Solution

  • You can do it with that code:

    pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
    

    It will start your game in full screen mode.