Best way to determine user's screensize?

Peter J. Holzer hjp-python at hjp.at
Fri Oct 30 19:56:30 EDT 2020


On 2020-10-31 10:02:12 +1100, Chris Angelico wrote:
> On Sat, Oct 31, 2020 at 9:55 AM flaskee via Python-list
> <python-list at python.org> wrote:
> > I have done all of this resizing and layout stuff before.
> >
> > I just ignored the grouchy user with the hate over me wanting screensize.
> > (every list has one of those types, eh? :-)
> >
> > Screensize, in part, determines the aspect ratio calcs to dynamically
> > resize and place the components on the screen.
> >
> 
> So what would you do if it turns out that my screen is 5440 x 2104?
> That's what mine is right now.

That depends on the application. 

If for example the application is in image viewer and the image to be
viewed is 4576x3432 pixels large, that wouldn't fit on the screen.
Assuming 200 pixels of vertical chrome (title bar, window borders, menu
bar and/or buttons), the image would have to be resized to (at most)
2539x1904 pixels. So the window would be sized to accommodate that.

(If you use a multi-screen setup, the calculation should be based on
the current screen, of course, not on the combined size of all screens)


> I add my voice to those who detest applications that think they know
> best and decide that they own the entire screen.

So, assuming the user is invoking the application for the first time,
how should an application determine how much of the screen it should
use? It has to make some choice, and any hard-coded value is almost
certainly wrong. So why should an application not use the screen size as
one factor?

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20201031/6f124391/attachment.sig>


More information about the Python-list mailing list