Best way to determine user's screensize?

Igor Korot ikorot01 at gmail.com
Sat Oct 31 12:54:59 EDT 2020


Hi,

On Sat, Oct 31, 2020, 8:40 AM Peter J. Holzer <hjp-python at hjp.at> wrote:

> On 2020-10-31 07:51:38 -0500, 2QdxY4RzWzUUiLuE at potatochowder.com wrote:
> > On 2020-10-31 at 13:02:03 +0100,
> > "Peter J. Holzer" <hjp-python at hjp.at> wrote:
> > > On 2020-10-31 12:30:43 +1100, Chris Angelico wrote:
> > > > There is no valid way for an application to read my mind and size
> > > > itself. Attempting to query my screen size seems to just make things
> > > > worse in a lot of situations.
> >
> > > You still haven't answered the question: Where should the initial
> > > window size come from? Does your window manager tell the application
> > > how large a window should be? And if it does, can you as a user
> > > configure that? I don't think mine (xfce) does that. (I guess tiling
> > > WMs generally do that, but I've never used one.)
> >
> > The intial/default window should be big enough to contain the
> > initial/default content, regardless of the configuration of the
> > screen(s)/monitor(s).
>
> As I already wrote in an answer to Igor, this is only possible if the
> initial/default content is of fixed size (or at least guaranteed to be
> smaller than the screen size).
>

Any control at any given moment has a fixed size.
If I can't set the initial size of the control in the appropriate layout
system, then this is not a layout system.
After the initial size is set it is up to the application to properly give
the aspect ratio, font sizes, etc when the application is moved between the
windows, resized, or DPI has changed, etc.


> Very often this is not the case: An image viewer will be used to display
> images which are larger than the screen. A MUA may have to display
> hundreds of mailboxes, and maybe tens of thousands of mails in a single
> mailbox.
>
> In these cases an application can't use the "natural size": It would be
> bigger than the screen, and depending on the window manager, the user
> might not even be able to resize it because the handles are off-screen.
>

What is natural size? Please define this term.


> It could use some size which is small enough to fit on any screen (how
> large is that? Can you assume 1366x768 these days?). But for most users
> this would be annoying, since they would have to resize the window.
>
> (And note that "the user has to do than only once, the second time the
> application can use the saved layout" doesn't hold either: The user may
> have invoked the application on a large desktop monitor the first time,
> but at some point they use the small laptop monitor or a projector.)
>

This is exactly my point.
If the underlying toolkit is smart enough and the layout system is good
then it won't matter.


> I am very much a fan of letting layout and window managers do as much as
> possible. But I don't think they can do everything. They simply don't
> have the necessary information.
>

Of course not.
Thats why software devs are paid big money to do proper designs. 😀

Thank you.


>         hp
>
> --
>    _  | Peter J. Holzer    | Story must make more sense than reality.
> |_|_) |                    |
> | |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
> __/   | http://www.hjp.at/ |       challenge!"
> --
> https://mail.python.org/mailman/listinfo/python-list
>


More information about the Python-list mailing list