ID:276902
 
I've been developing a small game in Python (with pygame) for a little while now, and I thought it would be nice to detect what resolution my users screen is set to, rather than assuming it's 1024 x 768. I searched some documentation in the sys and os modules. However, they either didn't have what I needed, or I just overlooked it. Can any point me where to go for this?

Thanks!
You can't do it directly with pygame or SDL as far as I know (it's planned I believe).

Here's one method (I googled it), but it only works for Windows: http://mail.python.org/pipermail/python-list/2005-February/ 267809.html

If you want to detect the screen resolution so that you can use that resolution for your game, in SDL 1.2.10 and above you can just pass 0 for the width and height when you're setting the video mode and it will just use the current resolution. That's a pretty new version though (came out less than 2 weeks ago I believe), so pygame doesn't use it yet; if you wait a month or so then they should update pygame to use it.
In response to Crispy
Thanks a lot! That's exactly what I needed.