Query screen resolution?

Warpcat warpcat at sbcglobal.net
Fri Aug 28 14:49:16 EDT 2009


On Aug 28, 11:27 am, "Rami Chowdhury" <rami.chowdh... at gmail.com>
wrote:
> > But I was hoping for something built-in, and something non-OS
> > specific.
>
> I don't know about built-ins, but I do believe that pygame (which *is*  
> cross-platform) will let you get at that information:
>        http://www.pygame.org/docs/ref/display.html#pygame.display.Info

Actually, I just came up with another hack using PyGame as well like
so:

screen = pygame.display.set_mode((0,0))
WIDTH, HEIGHT = screen.get_size()

If you pass zero values into the resolution, it will pop to the
current screen resolution.  And since I'm making a PyGame app, this
actually works out ok.  However, querying the current_w & current_h
attrs from the Info object is a lot cleaner (I was unaware of that,
thanks!)

But I'd sure like to know if there is built-in way.




More information about the Python-list mailing list