Getting screen dims platform specific? Say it ain't so!

John McMonagle jmcmonagle at NO.SPAM.velseis.com.au
Tue Feb 24 19:38:46 EST 2009


Lionel wrote:
> Yes, it's platform specific. I was just trying anyway to see if it
> would work.
> 
> In a nutshell, what I need is a way to acquire the screen dimensions
> (in pixels) and its dpi setting.

This should work on all platforms:

from Tkinter import *
r = Tk()
r.withdraw()
r.winfo_screenheight()
r.winfo_screenwidth()
r.winfo_pixels('1i')


Regards,

John



More information about the Python-list mailing list