Best way to determine user's screensize?

Serhiy Storchaka storchaka at gmail.com
Sat Oct 31 16:34:24 EDT 2020


30.10.20 17:56, flaskee via Python-list пише:
> Perhaps a more tactical approach would best to figure
> out how to do cross-platform python apps.
> 
> What is the best approach to determining the user's available screensize,
> when they open your python application?
> 
> Note that the "desktop" application could be running on Android, iOS,
> MacOS, Windows or Linux (I think that I understand how to handle it for browser-based things.)
> 
> As close to an all Python answer as possible, would be optimal.

It depends on the GUI toolkit you are using.

For example in Tkinter you can use methods winfo_screenwidth() and
winfo_screenheight() of your widget if you need the size in pixels.
winfo_screenmmwidth() and winfo_screenmmheight() return the size in
millimeters.

For other toolkits look at the corresponding documentation.



More information about the Python-list mailing list