Search code examples
pythonpygame

how can i mantain a specific proportion while resizing a window?


I'm making a game in Python with a fullscreen option button.

How can I allow window resize when not in fullscreen, keeping the window ratio the same?

Also, how can I set the ratio to avoid problems if someone puts fullscreen in a monitor with a different ratio from 16/9?


Solution

  • You can't. The screen resolution depends on the hardware. Not every hardware supports every resolution. You have to write an application that can handle different display resolutions. e.g.: Scale Everything On Pygame Display Surface.