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.

1 Like

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
2 Likes

Thank you! pygame.FULLSCREEN was key!

2 Likes

My pleasure, have fun!

1 Like

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

1 Like

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!

1 Like

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.

1 Like

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

1 Like

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.

1 Like

Hi Lena,
Thanks for working with me on this.
So I tried what you said, and it worked…sort of.

Check out these 2 videos (watch video 1 first) to see what we are experiencing.

Video 1
https://drive.google.com/file/d/1vEelcGgJ8CQP1DiE8y6AXprzFiqHNE2R/view?usp=sharing

Video 2
https://drive.google.com/file/d/1nYkqB8Y6AUG1ZAa2c8KGyaqhuP59kCm5/view?usp=sharing

Thoughts?
Tyler

1 Like

Hi again,

Update: When I reloaded both tabs (the private and team repl) the pygame window was full screen again, which is great.
So I’m still wondering why the poetry and pyproject files are not good on the creation of a new pygame team repl.

Thanks
Tyler

1 Like