Resizing a pygame output window

When running a pygame project in replit, the output window is very small and the screen does not automatically adjust. Does anyone have a way of quickly resizing the window (other than resizing all of the panes)?

I’ve seen students do it, and they’ve tried to show me, but it never seems to work for me.

At the bottom of your main Python file try this:

if __name__ == '__main__': 
  win = pygame.display.set_mode((s_width, s_height), pygame.FULLSCREEN)
  pygame.display.set_caption('Tetris')
  
  main_menu()  # start game
1 Like

Thank you! pygame.FULLSCREEN was key!

1 Like

My pleasure, have fun!

Hi Derrick,

I’m back to using pygame in replit this semester. Earlier this semester you seemed to have the solution for resizing the window using pygame.FULLSCREEN.

It doesn’t seem to be working for us. It still seems to be zoomed in (cropping the window to the slider size). Can we not have a smaller work area and have the window be resized accordingly?
Could you take a look here (I’m not sure if you can access this replit or not): https://replit.com/@ICS3U1012122/90-Basic-Graphics-MichaelF8#main.py

Let me know what you think,
Thanks
Tyler

Hey Tyler! Can you share a public repl or a code snippet for us to look at and we can see if we can help!

It looks like I can only send 1 piece of media at a time, so I’ll break this email up.

Here is the link to the public replit.

https://replit.com/@TylerWright4/screenIssue#main.py

I (and my students) are seeing an issue with the pygame display window when I run the same program in a public replit vs a team replit.

Here is an image when I hit ‘run’ in the public replit
It looks good.

Part 2:
Here is the exact same program in a team replit. For some reason, in the team, the window doesn’t size correctly.

Thanks sm for sharing these additional details! I asked around on our team and we think it may be because the two projects are running different versions of pygame. If the repls were created at slightly different times (and because Team repls may get updated on a different schedule than personal repls), it’s possible that one was updated before the other.

To get the exact same behavior, you can copy the poetry.lock and pyproject.toml files from the correct repl into the repl with unexpected behavior.