Best way to determine user's screensize?

Peter J. Holzer hjp-python at hjp.at
Sat Oct 31 19:17:26 EDT 2020


On 2020-10-31 17:12:36 -0500, 2QdxY4RzWzUUiLuE at potatochowder.com wrote:
> On 2020-10-31 at 19:24:34 +0100,
> "Peter J. Holzer" <hjp-python at hjp.at> wrote:
> > On 2020-10-31 11:58:41 -0500, 2QdxY4RzWzUUiLuE at potatochowder.com wrote:
> > > I never claimed it was easy.  Yes, the author of an MUA has to make a
> > > guess and a bunch of decisions about a useful default setup (such a set
> > > of defaults already appears elsewhere in this thread).
> > 
> > Aha. And why would be better to "make a guess" than to use information
> > available at runtime?
> 
> Some information, sure.  Please don't assume that physical pixels or
> physical millimeters of display space relate to useful window sizes.

It does. It's the upper bound. The window may be smaller, but not
larger.

> > > But I'm sticking to my story:  that setup should be based on
> > > *application domain* objects, like messages and mailboxes, and not
> > > size(s) of the screen(s) (in pixels or inches).
> > 
> > I'm also sticking to my story that those objects are frequently too
> > large too display completely. They will need a container with a
> > scroll-bar. And then you need to decide how large that container should
> > be.
> 
> Again, I don't think we're disagreeing.  Our shiny new MUA comes up and
> finds 10 million messages in the user's inbox.  Pick a number of
> messages, like 10, or 42, and start there.  Don't start with the screen
> size and do a bunch of font metric arithmetic to come up with a number
> of pixels.

We do disagree fundamentally here. I think picking an arbitrary number
like 10 or 42 out of thin air is fundamentally broken. Computing than
number by dividing the screen height (minus chrome) by the height of one
element is the right thing to do.

(Using the number stored last time when the user resized the window is
of course also ok (because that was the user, not the programmer). But
the application has to be ready to adjust that if the current screen is
smaller)

        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/20201101/e018a43b/attachment.sig>


More information about the Python-list mailing list