Best way to determine user's screensize?

Tim Chase python.list at tim.thechases.com
Sat Oct 31 13:25:43 EDT 2020


On 2020-10-31 15:22, Grant Edwards wrote:
> > A MUA may have to display hundreds of mailboxes, and maybe tens of
> > thousands of mails in a single mailbox.  
> 
> No. It doesn't. It has to display a tree widget that shows N items
> and holds tens of thousands of items, or a scrolling list widget
> than shows M items and holds tens of thousands of items.  Pick
> reasonable initial default values for N,M and then let the window
> manager and user do the right thing.

But that's exactly the issue.  On my phone, a "reasonable default N"
might be 7 items and consume the whole screen; whereas on my netbook,
a "reasonable default N" might be 15 in one layout or 25 in another;
and on my daily driver, a "reasonable default N" might well be 50 or
100 depending on layout or monitor orientation.

How does the application determine "reasonable"?  It probes the
system for screen dimensions (hopefully with multi-monitor smarts)
and then makes an attempt to paint the display.

This doesn't free it from being subject to a window manager's
subsequent constraints, but at least allows the application to make
some sensible choices for initial defaults.  Some window-managers are
dumb (glares at Windows), some are accommodating (I like how Fluxbox
behaves), some are dictatorial (e.g. tiling window managers that give
far less wiggle-room for applications' dimensions), and some largely
ignore the user ("maximize" on MacOS annoys me to no end, maximizing
only enough to display all the content; when what I want is to obscure
everything else for single-app focus; requiring me to manually resize
the window with the mouse so it fills the screen).

-tkc






More information about the Python-list mailing list